Skip to content

Commit d10866c

Browse files
committed
Fire onExit for feature terminals that lost pty host connection
Fixes microsoft#118073
1 parent b33801c commit d10866c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
7474
private _ptyResponsiveListener: IDisposable | undefined;
7575
private _ptyListenersAttached: boolean = false;
7676
private _dataFilter: SeamlessRelaunchDataFilter;
77+
private _isFeatureTerminal: boolean = false;
7778

7879
private readonly _onPtyDisconnect = this._register(new Emitter<void>());
7980
public get onPtyDisconnect(): Event<void> { return this._onPtyDisconnect.event; }
@@ -177,6 +178,7 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
177178
isScreenReaderModeEnabled: boolean,
178179
reset: boolean = true
179180
): Promise<ITerminalLaunchError | undefined> {
181+
this._isFeatureTerminal = !!shellLaunchConfig.isFeatureTerminal;
180182
if (shellLaunchConfig.isExtensionCustomPtyTerminal) {
181183
this._processType = ProcessType.ExtensionTerminal;
182184
this._process = this._instantiationService.createInstance(TerminalProcessExtHostProxy, this._instanceId, shellLaunchConfig, cols, rows);
@@ -404,6 +406,13 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
404406
}
405407
this._ptyResponsiveListener?.dispose();
406408
this._ptyResponsiveListener = undefined;
409+
// Indicate the process is exited (and gone forever) only for feature terminals so they
410+
// can react to the exit, this is particularly important for tasks so that it knows that
411+
// the process is not still active. Note that this is not done for regular terminals
412+
// because otherwise the terminal instance would be disposed
413+
if (this._isFeatureTerminal) {
414+
this._onExit(undefined);
415+
}
407416
}));
408417
}
409418

0 commit comments

Comments
 (0)