Skip to content

Commit

Permalink
Override urfave OsExiter to prevent it from wreaking havoc
Browse files Browse the repository at this point in the history
  • Loading branch information
brikis98 committed Jan 7, 2017
1 parent 03756c4 commit 1de67c8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions entrypoint/entrypoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ const defaultErrorExitCode = 1

// Run the given app, handling errors, panics, and stack traces where possible
func RunApp(app *cli.App) {
cli.OsExiter = func(exitCode int) {
// Do nothing. We just need to override this function, as the default value calls os.Exit, which
// kills the app (or any automated test) dead in its tracks.
}

defer errors.Recover(checkForErrorsAndExit)
err := app.Run(os.Args)
checkForErrorsAndExit(err)
Expand Down

0 comments on commit 1de67c8

Please sign in to comment.