diff options
Diffstat (limited to 'exit.go')
| -rw-r--r-- | exit.go | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -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) +} |
