File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ export class PythonDebugger extends DebugSession {
104104 }
105105 }
106106 private InitializeEventHandlers ( ) {
107- this . pythonProcess . on ( "last" , arg => this . onDetachDebugger ( ) ) ;
107+ this . pythonProcess . on ( "last" , arg => this . onLastCommand ( ) ) ;
108108 this . pythonProcess . on ( "threadExited" , arg => this . onPythonThreadExited ( arg ) ) ;
109109 this . pythonProcess . on ( "moduleLoaded" , arg => this . onPythonModuleLoaded ( arg ) ) ;
110110 this . pythonProcess . on ( "threadCreated" , arg => this . onPythonThreadCreated ( arg ) ) ;
@@ -119,6 +119,17 @@ export class PythonDebugger extends DebugSession {
119119
120120 this . debugServer . on ( "detach" , ( ) => this . onDetachDebugger ( ) ) ;
121121 }
122+ private onLastCommand ( ) {
123+ // If we're running in terminal (integrated or external)
124+ // Then don't stop the debug server
125+ if ( this . launchArgs && ( this . launchArgs . console === "externalTerminal" ||
126+ this . launchArgs . console === "integratedTerminal" ) ) {
127+ return ;
128+ }
129+
130+ // Else default behaviour as previous, which was to perform the same as onDetachDebugger
131+ this . onDetachDebugger ( ) ;
132+ }
122133 private onDetachDebugger ( ) {
123134 this . stopDebugServer ( ) ;
124135 this . sendEvent ( new TerminatedEvent ( ) ) ;
You can’t perform that action at this time.
0 commit comments