Skip to content

Commit

Permalink
doc(App.Run): Clarify exit code (#1254)
Browse files Browse the repository at this point in the history
A user expressed confusion about the exit code of an Fx application
that was interrupted with Ctrl-C.

Clarify in the documentation that the exit code will be non-zero
only if there was a failure, or if Shutdown specifically requested
a non-zero exit code.
  • Loading branch information
abhinav authored Jan 4, 2025
1 parent aa85ee9 commit 7eebf3c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,14 @@ func (app *App) exit(code int) {
// All of Run's functionality is implemented in terms of the exported
// Start, Done, and Stop methods. Applications with more specialized needs
// can use those methods directly instead of relying on Run.
//
// After the application has started,
// it can be shut down by sending a signal or calling [Shutdowner.Shutdown].
// On successful shutdown, whether initiated by a signal or by the user,
// Run will return to the caller, allowing it to exit cleanly.
// Run will exit with a non-zero status code
// if startup or shutdown operations fail,
// or if the [Shutdowner] supplied a non-zero exit code.
func (app *App) Run() {
// Historically, we do not os.Exit(0) even though most applications
// cede control to Fx with they call app.Run. To avoid a breaking
Expand Down

0 comments on commit 7eebf3c

Please sign in to comment.