Add exit.Reset helper to reset to default value
@@ -10,14 +10,23 @@ import (
"os"
)
-var Exit = func(code int) {
+var def = func(code int) {
os.Exit(code)
}
+var Exit = def
+
+// Sets the implementation of Exit() to the default.
+func Reset() {
+ Exit = def
+}
+
+// Exits with a failure status.
func Fail() {
Exit(1)
}
+// Exits with a success status.
func Success() {
Exit(0)
}
