autotypist/shell.go

35 lines
687 B
Go

package main
import (
"strings"
"go.wit.com/lib/gui/shell"
"go.wit.com/log"
)
// only errors on bad errors
func quickCmd(fullpath string, cmd []string) bool {
if me.autoDryRun.Checked() {
log.Warn("RUN --dry-run", fullpath, cmd)
return false
} else {
log.Warn("RUN:", fullpath, cmd)
}
r := shell.PathRun(fullpath, cmd)
output := strings.TrimSpace(strings.Join(r.Stdout, "\n"))
if r.Error != nil {
log.Warn("cmd =", cmd)
log.Warn("err =", r.Error)
log.Warn("b =", r.Exit)
log.Warn("output =", output)
return false
} else if r.Exit != 0 {
log.Warn("b =", r.Exit)
log.Warn("output =", output)
return true
}
log.Warn("output = ", output)
return true
}