use go-cmd/cmd

This commit is contained in:
Jeff Carr 2024-11-08 06:41:47 -06:00
parent b33280b869
commit 169d2127da
2 changed files with 14 additions and 20 deletions

View File

@ -122,7 +122,7 @@ func (r *repoWindow) repoMenu() *gui.Node {
r.Disable()
defer r.Enable()
for _, repo := range r.View.AllRepos() {
repo.RunCmd([]string{"git", "pull"})
repo.Run([]string{"git", "pull"})
}
})

View File

@ -1,21 +1,14 @@
package main
import (
"go.wit.com/log"
"strings"
"go.wit.com/lib/gui/repostatus"
"go.wit.com/log"
"go.wit.com/lib/gui/shell"
)
// only errors on bad errors
func quickCmd(fullpath string, cmd []string) bool {
var err error
var b bool
var output string
// if me.autoWorkingPwd.String() != fullpath {
// me.autoWorkingPwd.SetValue(fullpath)
// }
if me.autoDryRun.Checked() {
log.Warn("RUN --dry-run", fullpath, cmd)
return false
@ -23,18 +16,19 @@ func quickCmd(fullpath string, cmd []string) bool {
log.Warn("RUN:", fullpath, cmd)
}
err, b, output = repostatus.RunCmd(fullpath, cmd)
if err != nil {
r := shell.PathRun(fullpath, cmd)
output := strings.TrimSpace(strings.Join(r.Stdout, "\n"))
if r.Error != nil {
log.Warn("cmd =", cmd)
log.Warn("err =", err)
log.Warn("b =", b)
log.Warn("output =", string(output))
log.Warn("err =", r.Error)
log.Warn("b =", r.Exit)
log.Warn("output =", output)
return false
} else if !b {
log.Warn("b =", b)
log.Warn("output =", string(output))
} else if r.Exit != 0 {
log.Warn("b =", r.Exit)
log.Warn("output =", output)
return true
}
log.Warn("output = ", string(output))
log.Warn("output = ", output)
return true
}