diff --git a/unix.go b/unix.go index 13a0981..28814c2 100644 --- a/unix.go +++ b/unix.go @@ -69,64 +69,3 @@ func setGitCommands() { } cmds.Set(strings.Join(tmp, "\n")) } - -/* -func runCommandsOld() bool { - for _, line := range me.script { - s := strings.Join(line, " ") - log.Warn("NEED TO RUN:", s) - err, b, output := repostatus.RunCmd(repopath, line) - if err != nil { - log.Warn("ABEND EXECUTION") - log.Warn("error =", err) - log.Warn("output =", output) - return false - } - log.Warn("Returned with b =", b) - log.Warn("output was =", output) - log.Warn("RUN DONE") - } - return true -} -*/ - -func RunCmdNew(workingpath string, parts []string) (error, bool, string) { - log.Warn("RUN NEW:", workingpath, parts) - return RunCmd(workingpath, parts) -} - -func RunCmd(workingpath string, parts []string) (error, bool, string) { - log.Warn("RUN CMD:", workingpath, parts) - if len(parts) == 0 { - log.Warn("command line was empty") - return errors.New("empty"), false, "" - } - if parts[0] == "" { - log.Warn("command line was empty") - return errors.New("empty"), false, "" - } - thing := parts[0] - parts = parts[1:] - - log.Warn("working path =", workingpath, "thing =", thing, "cmdline =", parts) - // Create the command - cmd := exec.Command(thing, parts...) - - // Set the working directory - cmd.Dir = workingpath - - // Execute the command - output, err := cmd.CombinedOutput() - if err != nil { - log.Error(err) - log.Warn("output was", string(output)) - log.Warn("cmd exited with error", err) - return err, false, string(output) - } - - tmp := string(output) - tmp = strings.TrimSpace(tmp) - - // Print the output - return nil, true, tmp -}