This repository was archived by the owner on Dec 19, 2018. It is now read-only.
This repository was archived by the owner on Dec 19, 2018. It is now read-only.
Handle SIGTERMs for graceful shutdown #870
Closed
Description
@stepro pointed out it should now be possible to handle SIGTERMs in addition to the SIGINTs (CTRL+C) that we already hook for graceful shutdown.
The managed API for SIGTERM is exposed by the AssemblyLoadContext.Unloading event, which is raised when the AppDomain.ProcessExit event is raised. I know this only because I’ve seen it used in the VSTS agent codebase (see this, line 44).
You can see how coreclr maps SIGTERM to shutting down here, line 170.
This should be especially useful for running in docker containers.