diff --git a/run.go b/run.go index e016a8e..4d674c5 100644 --- a/run.go +++ b/run.go @@ -46,7 +46,7 @@ func Run(args []string) bool { } r := RunPath(dir, args) - if r.ok { + if r.Ok { return true } return false @@ -55,27 +55,27 @@ func Run(args []string) bool { var ErrorArgvEmpty error = errors.New("command was empty") type RunResult struct { - ok bool - argv []string - path string - output []byte - err error - outerr error + Ok bool + Argv []string + Path string + Output []byte + Err error + Outerr error } // run, but set the working path func RunPath(path string, args []string) *RunResult { r := new(RunResult) - r.path = path - r.argv = args + r.Path = path + r.Argv = args if len(args) == 0 { - r.ok = true - r.err = ErrorArgvEmpty + r.Ok = true + r.Err = ErrorArgvEmpty return r } if args[0] == "" { - r.ok = false - r.err = ErrorArgvEmpty + r.Ok = false + r.Err = ErrorArgvEmpty return r } thing := args[0] @@ -84,6 +84,7 @@ func RunPath(path string, args []string) *RunResult { cmd.Dir = path cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr + log.Info("path =", path, "cmd =", strings.Join(args, " ")) if err := cmd.Run(); err != nil { // Handle error if the command execution fails @@ -95,16 +96,16 @@ func RunPath(path string, args []string) *RunResult { // log.Info("path =", path) // log.Info("args =", args) // log.Info("err =", err.Error()) - r.ok = false - r.err = err - r.output = out - r.outerr = outerr + r.Ok = false + r.Err = err + r.Output = out + r.Outerr = outerr return r } out, outerr := cmd.Output() - r.output = out - r.outerr = outerr - r.ok = true + r.Output = out + r.Outerr = outerr + r.Ok = true return r }