gllvm/shared/utils.go

27 lines
637 B
Go
Raw Normal View History

package shared
2017-06-26 21:42:47 +02:00
import (
"os"
"os/exec"
2017-06-26 21:42:47 +02:00
)
// Executes a command then returns true for success, false if there was an error, err is either nil or the error.
func execCmd(cmdExecName string, args []string, workingDir string) (success bool, err error) {
cmd := exec.Command(cmdExecName, args...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Stdin = os.Stdin
cmd.Dir = workingDir
err = cmd.Run()
ecode := 0
if err != nil {
ecode = 1
}
LogDebug("execCmd: %v %v in %v had exitCode %v\n", cmdExecName, args, workingDir, ecode)
if err != nil {
LogDebug("execCmd: error was %v\n", err)
}
success = (ecode == 0)
return
2017-06-26 21:42:47 +02:00
}