@@ -164,6 +164,7 @@ def __init__(
164164 self .output : dict [str , list [str ]] = {}
165165 self .configuration_done_sent = False
166166 self .initialized = False
167+ self .terminated = False
167168 self .frame_scopes = {}
168169 self .init_commands = init_commands
169170
@@ -271,6 +272,10 @@ def _handle_recv_packet(self, packet: Optional[ProtocolMessage]) -> bool:
271272 # When a new process is attached or launched, remember the
272273 # details that are available in the body of the event
273274 self .process_event_body = body
275+ elif event == "terminated" :
276+ # If we get the 'terminated' event then lldb-dap has exited
277+ # itself.
278+ self .terminated = True
274279 elif event == "exited" :
275280 # Process exited, mark the status to indicate the process is not
276281 # alive.
@@ -388,7 +393,7 @@ def send_recv(self, command):
388393 if response_or_request ["command" ] == "runInTerminal" :
389394 subprocess .Popen (
390395 response_or_request ["arguments" ]["args" ],
391- env = response_or_request ["arguments" ][ "env" ] ,
396+ env = response_or_request ["arguments" ]. get ( "env" , {}) ,
392397 )
393398 self .send_packet (
394399 {
@@ -749,13 +754,11 @@ def request_restart(self, restartArguments=None):
749754 # Caller must still call wait_for_stopped.
750755 return response
751756
752- def request_disconnect (self , terminateDebuggee = None ):
753- args_dict = {}
754- if terminateDebuggee is not None :
755- if terminateDebuggee :
756- args_dict ["terminateDebuggee" ] = True
757- else :
758- args_dict ["terminateDebuggee" ] = False
757+ def request_disconnect (self , terminateDebuggee = False , suspendDebuggee = False ):
758+ args_dict = {
759+ "terminateDebuggee" : terminateDebuggee ,
760+ "suspendDebuggee" : suspendDebuggee ,
761+ }
759762 command_dict = {
760763 "command" : "disconnect" ,
761764 "type" : "request" ,
0 commit comments