MCPcopy
hub / github.com/uber-go/fx / Run

Method Run

app.go:596–603  ·  view source on GitHub ↗

Run starts the application, blocks on the signals channel, and then gracefully shuts the application down. It uses [DefaultTimeout] to set a deadline for application startup and shutdown, unless the user has configured different timeouts with the [StartTimeout] or [StopTimeout] options. It's designe

()

Source from the content-addressed store, hash-verified

594// if startup or shutdown operations fail,
595// or if the [Shutdowner] supplied a non-zero exit code.
596func (app *App) Run() {
597 // Historically, we do not os.Exit(0) even though most applications
598 // cede control to Fx with they call app.Run. To avoid a breaking
599 // change, never os.Exit for success.
600 if code := app.run(app.Wait); code != 0 {
601 app.exit(code)
602 }
603}
604
605func (app *App) run(done func() <-chan ShutdownSignal) (exitCode int) {
606 startCtx, cancel := app.clock.WithTimeout(context.Background(), app.StartTimeout())

Callers 15

TestWindowsMinimalAppFunction · 0.80
TestReplaceSuccessFunction · 0.80
TestReplaceFailureFunction · 0.80
TestExtractFunction · 0.80
TestOptionalTypesFunction · 0.80
TestNewAppFunction · 0.80
TestPrivateFunction · 0.80
TestWithLoggerFunction · 0.80
TestModuleTraceFunction · 0.80
TestRunEventEmissionFunction · 0.80
TestInvokesFunction · 0.80

Calls 2

runMethod · 0.95
exitMethod · 0.95

Tested by 15

TestWindowsMinimalAppFunction · 0.64
TestReplaceSuccessFunction · 0.64
TestReplaceFailureFunction · 0.64
TestExtractFunction · 0.64
TestOptionalTypesFunction · 0.64
TestNewAppFunction · 0.64
TestPrivateFunction · 0.64
TestWithLoggerFunction · 0.64
TestModuleTraceFunction · 0.64
TestRunEventEmissionFunction · 0.64
TestInvokesFunction · 0.64