Nth attempt at correct shutdown procedure.

If we install an explicit signal handler for SIGTERM and SIGINT and then call
sys.exit ourselves, atexit handlers are run. If we don't call sys.exit from the
handler, ycmd never shuts down. So fixed... I think. We'll see.

Fixes #577... again.
This commit is contained in:
Strahinja Val Markovic 2013-10-17 22:12:28 -07:00
parent a5fb6b7509
commit f6ca040cf7

View File

@ -35,12 +35,11 @@ def YcmCoreSanityCheck():
raise RuntimeError( 'ycm_core already imported, ycmd has a bug!' )
# We need to manually call ServerShutdown for the signals that turn down ycmd
# because atexit won't handle them.
# We manually call sys.exit() on SIGTERM and SIGINT so that atexit handlers are
# properly executed.
def SetUpSignalHandler():
def SignalHandler( signum, frame ):
import handlers
handlers.ServerShutdown()
sys.exit()
for sig in [ signal.SIGTERM,
signal.SIGINT ]: