mirror of
https://github.com/go-task/task.git
synced 2025-01-08 04:04:08 +02:00
24 lines
392 B
Go
24 lines
392 B
Go
package execext
|
|
|
|
import (
|
|
"context"
|
|
"os/exec"
|
|
)
|
|
|
|
var (
|
|
// ShPath is path to "sh" command
|
|
ShPath string
|
|
// ShExists is true if "sh" command is available on the system
|
|
ShExists bool
|
|
)
|
|
|
|
func init() {
|
|
var err error
|
|
ShPath, err = exec.LookPath("sh")
|
|
ShExists = err == nil
|
|
}
|
|
|
|
func newShCommand(ctx context.Context, c string) *exec.Cmd {
|
|
return exec.CommandContext(ctx, ShPath, "-c", c)
|
|
}
|