Skip to content

Commit 702d50f

Browse files
committed
fix #693
1 parent ff1812e commit 702d50f

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

src/client/debugger/Main.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff 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());

0 commit comments

Comments
 (0)