summaryrefslogtreecommitdiff
path: root/unix.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-18 15:12:33 -0600
committerJeff Carr <[email protected]>2024-01-18 15:12:33 -0600
commita1aa87c78a1441753c1746058a82ca52bcd64ba2 (patch)
treef94bbe9437579057a2da8c99512d0285bca77b94 /unix.go
parentcbafaa3c662203f9e0c42a0dcffc0057a297d1fb (diff)
old code
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'unix.go')
-rw-r--r--unix.go61
1 files changed, 0 insertions, 61 deletions
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
-}