diff options
| author | Jeff Carr <[email protected]> | 2025-10-07 19:31:00 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-07 19:31:00 -0500 |
| commit | 4be7ade52e35c3f9af51c7e4842f96a2f22971a8 (patch) | |
| tree | 4ce0683361bafcd9a4a3f1aee94bfb4ab252f463 /exit.go | |
| parent | 48bcafb2e388295567476f35e45b814f71692061 (diff) | |
switch to me.sh.Exit()v0.1.25
Diffstat (limited to 'exit.go')
| -rw-r--r-- | exit.go | 20 |
1 files changed, 5 insertions, 15 deletions
@@ -14,7 +14,7 @@ import ( // exits if not root func checkSuperuser() { if os.Getuid() != 0 { - badExit(fmt.Errorf("you must be root")) + me.sh.BadExit("you must run as root", nil) } } @@ -30,7 +30,8 @@ func exitOnError(cmd []string) { log.Info("Running:", cmd) _, err = shell.RunVerbose(cmd) if err != nil { - badExit(err) + msg := fmt.Sprintf("Ran: %v", cmd) + me.sh.BadExit(msg, err) } } @@ -39,18 +40,7 @@ func exitOnErrorRealtime(cmd []string) { log.Info("Running:", cmd) _, err = shell.RunRealtimeError(cmd) if err != nil { - badExit(err) + msg := fmt.Sprintf("Ran: %v", cmd) + me.sh.BadExit(msg, err) } } - -func okExit(thing string) { - if thing != "" { - log.Info(thing, "ok") - } - os.Exit(0) -} - -func badExit(err error) { - me.sh.BadExit("wit failed: ", err) - os.Exit(-1) -} |
