Little refactor on command creation

This commit is contained in:
Andrey Nering
2017-03-12 17:18:59 -03:00
parent 678ea86350
commit 8c5e7e89cd
5 changed files with 62 additions and 28 deletions

22
execext/exec.go Normal file
View File

@@ -0,0 +1,22 @@
package execext
import (
"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(c string) *exec.Cmd {
return exec.Command(ShPath, "-c", c)
}