Files
task/execext/exec_win.go

22 lines
426 B
Go
Raw Normal View History

2017-03-12 17:18:59 -03:00
// +build windows
package execext
import (
"context"
2017-03-12 17:18:59 -03:00
"os/exec"
)
// NewCommand returns a new command that runs on "sh" is available or on "cmd"
// otherwise on Windows
func NewCommand(ctx context.Context, c string) *exec.Cmd {
2017-03-12 17:18:59 -03:00
if ShExists {
return newShCommand(ctx, c)
2017-03-12 17:18:59 -03:00
}
return newCmdCommand(ctx, c)
2017-03-12 17:18:59 -03:00
}
func newCmdCommand(ctx context.Context, c string) *exec.Cmd {
return exec.CommandContext(ctx, "cmd", "/C", c)
2017-03-12 17:18:59 -03:00
}