guireleaser/quickCmd.go

51 lines
918 B
Go

package main
import (
"os"
"go.wit.com/lib/gui/repostatus"
"go.wit.com/log"
)
func doesExist(path string) bool {
if _, err := os.Stat(path); err != nil {
if os.IsNotExist(err) {
return false
}
}
return true
}
// 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
} else {
log.Warn("RUN:", fullpath, cmd)
}
err, b, output = repostatus.RunCmd(fullpath, cmd)
if err != nil {
log.Warn("cmd =", cmd)
log.Warn("err =", err)
log.Warn("b =", b)
log.Warn("output =", string(output))
return false
} else if !b {
log.Warn("b =", b)
log.Warn("output =", string(output))
return true
}
log.Warn("output = ", string(output))
return true
}