Ensure the handler runs by setting it before killing the job. The callback must be being called syncronously if the process terminates immediately

This commit is contained in:
Ben Jackson 2019-07-27 11:23:54 +01:00
commit 5076c62ed2

View file

@ -452,14 +452,14 @@ class DebugSession( object ):
def _StopDebugAdapter( self, callback = None ):
def handler( *args ):
vim.eval( 'vimspector#internal#{}#StopDebugSession()'.format(
self._connection_type ) )
if callback:
self._logger.debug( "Setting server exit handler for disconnect" )
self._logger.debug( "Setting server exit handler before disconnect" )
assert not self._run_on_server_exit
self._run_on_server_exit = callback
vim.eval( 'vimspector#internal#{}#StopDebugSession()'.format(
self._connection_type ) )
arguments = {}
if self._server_capabilities.get( 'supportTerminateDebuggee' ):
arguments[ 'terminateDebugee' ] = True