summaryrefslogtreecommitdiff
path: root/exit.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-26 22:41:47 -0500
committerJeff Carr <[email protected]>2025-10-26 22:41:47 -0500
commit4d0828def125f96d376cc1bd018bd3d8b0997901 (patch)
treeb683bbe08350c6e5b78eba65be9a6496091c874b /exit.go
parent59c9500872620a0e43752d7ebf352804aaf49925 (diff)
rearranging filenames
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)
+}