uber-go/fx

signalReceivers should call `Signal.Stop(recv.signals)` when stopped

Closed this issue · 0 comments

Describe the bug

signalReceivers should call Signal.Stop(recv.signals) when they are Stop()ed.

Because if not, then when a user does:

app.Start(...)
app.Close(...)

// block on anything else
select {} // for example

the program will fail to exit when the user presses ctrl-c. Which is contrary to what one would expect after starting and stopping the fx app.

To Reproduce

Example

func main() {
	app := fx.New()
	app.Start(context.Background())
	app.Stop(context.Background())

	select {}
}

ctrl-c should exit the program

Expected behavior
the signal handler reverts back to Go's default signal handler

Additional context
should be a ~1 line change :)