autotypist/shell.go

35 lines
687 B
Go
Raw Permalink Normal View History

2024-02-25 13:09:56 -06:00
package main
import (
2024-11-08 06:41:47 -06:00
"strings"
2024-02-25 13:09:56 -06:00
2024-11-08 06:41:47 -06:00
"go.wit.com/lib/gui/shell"
2024-11-13 11:56:58 -06:00
"go.wit.com/log"
2024-02-25 13:09:56 -06:00
)
// 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)
}
2024-11-08 06:41:47 -06:00
r := shell.PathRun(fullpath, cmd)
output := strings.TrimSpace(strings.Join(r.Stdout, "\n"))
if r.Error != nil {
2024-02-25 13:09:56 -06:00
log.Warn("cmd =", cmd)
2024-11-08 06:41:47 -06:00
log.Warn("err =", r.Error)
log.Warn("b =", r.Exit)
log.Warn("output =", output)
2024-02-25 13:09:56 -06:00
return false
2024-11-08 06:41:47 -06:00
} else if r.Exit != 0 {
log.Warn("b =", r.Exit)
log.Warn("output =", output)
2024-02-25 13:09:56 -06:00
return true
}
2024-11-08 06:41:47 -06:00
log.Warn("output = ", output)
2024-02-25 13:09:56 -06:00
return true
}