summaryrefslogtreecommitdiff
path: root/exit.go
diff options
context:
space:
mode:
Diffstat (limited to 'exit.go')
-rw-r--r--exit.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/exit.go b/exit.go
index 364684e..fdaec8a 100644
--- a/exit.go
+++ b/exit.go
@@ -7,7 +7,7 @@ import "os"
// argv normally sets these callbacks
// argv has timing set from when os.Args was parsed
-func GoodExit(reason string, err error) {
+func GoodExit(reason string) {
if goodExit != nil {
goodExit(reason)
}
@@ -20,3 +20,12 @@ func BadExit(reason string, err error) {
}
os.Exit(-1)
}
+
+func Exit(reason string, err error) {
+ if err == nil {
+ GoodExit(reason)
+ os.Exit(0)
+ }
+ BadExit(reason, err)
+ os.Exit(-1)
+}