summaryrefslogtreecommitdiff
path: root/exit.go
diff options
context:
space:
mode:
Diffstat (limited to 'exit.go')
-rw-r--r--exit.go20
1 files changed, 5 insertions, 15 deletions
diff --git a/exit.go b/exit.go
index 6010a2e..05cbd02 100644
--- a/exit.go
+++ b/exit.go
@@ -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)
-}