Skip to content

Commit 988c8ba

Browse files
committed
Don't allow terminating the shell when running in the built-in Terminal
Fixes #2750.
1 parent 1643866 commit 988c8ba

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎src/debug/dart_debug_impl.ts‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,16 @@ export class DartDebugSession extends DebugSession {
335335
if (response.success) {
336336
this.log(` PID: ${process.pid}`);
337337
const resp = response as DebugProtocol.RunInTerminalResponse;
338-
resolve(new RemoteEditorTerminalProcess(resp.body.processId || resp.body.shellProcessId));
338+
339+
// Do not fall back to `resp.body.shellProcessId` here, as terminating the shell
340+
// during shutdown will result in an error on Windows being shown to the user.
341+
// https://github.com/Dart-Code/Dart-Code/issues/2750
342+
//
343+
// When running in debug mode, we should have the real PID via the VM Service
344+
// anyway, and when not running in debug mode we "terminate" immediately and
345+
// would not be showing a debug toolbar for the user to terminate anyway (any
346+
// disconnect event we get is because the process already finished).
347+
resolve(new RemoteEditorTerminalProcess(resp.body.processId));
339348
} else {
340349
reject(response.message);
341350
}

0 commit comments

Comments
 (0)