summaryrefslogtreecommitdiff
path: root/unix.go
diff options
context:
space:
mode:
Diffstat (limited to 'unix.go')
-rw-r--r--unix.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/unix.go b/unix.go
index b4f604f..a1030dc 100644
--- a/unix.go
+++ b/unix.go
@@ -10,6 +10,7 @@ import (
"path/filepath"
"regexp"
"strings"
+ "syscall"
"go.wit.com/log"
)
@@ -115,6 +116,17 @@ func splitVersion(version string) (a, b, c string) {
}
}
+func (rs *RepoStatus) RunCmd(parts []string) (error, string) {
+ path := rs.realPath.String()
+ err, _, output := RunCmd(path, parts)
+ if err != nil {
+ log.Log(WARN, "cmd:", parts)
+ log.Log(WARN, "ouptput:", output)
+ log.Log(WARN, "failed with error:", err)
+ }
+ return err, output
+}
+
// temp hack. fix this
func runCmd(path string, parts []string) (error, bool, string) {
return RunCmd(path, parts)
@@ -162,6 +174,16 @@ func RunCmd(workingpath string, parts []string) (error, bool, string) {
log.Warn("cmd exited with error", err)
// panic("fucknuts")
return err, false, string(output)
+
+ // The command failed (non-zero exit status)
+ if exitErr, ok := err.(*exec.ExitError); ok {
+ // Assert that it is an exec.ExitError and get the exit code
+ if status, ok := exitErr.Sys().(syscall.WaitStatus); ok {
+ log.Warn("Exit Status: %d\n", status.ExitStatus())
+ }
+ } else {
+ log.Warn("cmd.Run() failed with %s\n", err)
+ }
}
tmp := string(output)