Stop server on SIGTERM by default#406
Conversation
|
Looks good! I was wondering if we should also handle SIGQUIT but that already works. See also this discussion for the common signals to terminate processes. SIGHUP might be interesting at some point. |
In what context? I have But interestingly This appears to be an issue inside containers. Is |
|
TODO: reconsider approach for multicore. |
Don't install the signal handler at the module scope, to avoid polluting the user's application with potentially unused handlers.
82ea2b8 to
2e4ed98
Compare
|
It's a bit difficult to observe the effects because, when starting Dream from the terminal, it inherits the signal handlers from the shell. But the signal handling doesn't work on master but does on this branch when using e.g. #!/bin/bash
trap '' SIGTERM SIGINT
setsid dune exec example/1-hello/hello.exe &
PID=$!I've also added a SIGINT handler because AFAICT this is the default (see e.g. https://go-cookbook.com/snippets/context/graceful-shutdowns) |
Fix #174