forge/windowMain.go

43 lines
893 B
Go
Raw Normal View History

package main
import (
"os"
2024-11-08 06:45:40 -06:00
"go.wit.com/lib/gui/shell"
2024-12-04 15:35:48 -06:00
"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 {
if me.autoDryRun.Checked() {
log.Warn("RUN --dry-run", fullpath, cmd)
return false
} else {
log.Warn("RUN:", fullpath, cmd)
}
2024-11-08 06:45:40 -06:00
result := shell.PathRun(fullpath, cmd)
if result.Error != nil {
log.Warn("quickCmd() cmd =", cmd)
log.Warn("quickCmd() err =", result.Error)
log.Warn("quickCmd() b =", result.Exit)
log.Warn("quickCmd() output =", result.Stdout)
return false
2024-11-08 06:45:40 -06:00
} else if result.Exit != 0 {
log.Warn("quickCmd() b =", result.Exit)
log.Warn("quickCmd() output =", result.Stdout)
return true
}
2024-11-08 06:45:40 -06:00
log.Warn("quickCmd() output = ", result.Stdout)
return true
}