Skip to content

Commit e741dcc

Browse files
committed
Clean current command on end
1 parent f8b1d52 commit e741dcc

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/vs/workbench/api/browser/mainThreadTerminalShellIntegration.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,23 @@ export class MainThreadTerminalShellIntegration extends Disposable implements Ma
3636

3737
// onDidStartTerminalShellExecution
3838
const commandDetectionStartEvent = this._store.add(this._terminalService.createOnInstanceCapabilityEvent(TerminalCapability.CommandDetection, e => e.onCommandExecuted));
39-
let lastCommand: ITerminalCommand | undefined;
39+
let currentCommand: ITerminalCommand | undefined;
4040
this._store.add(commandDetectionStartEvent.event(e => {
4141
// Prevent duplicate events from being sent in case command detection double fires the
4242
// event
43-
if (e.data === lastCommand) {
43+
if (e.data === currentCommand) {
4444
return;
4545
}
46-
lastCommand = e.data;
46+
currentCommand = e.data;
4747
this._proxy.$shellExecutionStart(e.instance.instanceId, e.data.command, e.data.cwd);
4848
}));
4949

5050
// onDidEndTerminalShellExecution
5151
const commandDetectionEndEvent = this._store.add(this._terminalService.createOnInstanceCapabilityEvent(TerminalCapability.CommandDetection, e => e.onCommandFinished));
52-
this._store.add(commandDetectionEndEvent.event(e => this._proxy.$shellExecutionEnd(e.instance.instanceId, e.data.command, e.data.exitCode)));
52+
this._store.add(commandDetectionEndEvent.event(e => {
53+
currentCommand = undefined;
54+
this._proxy.$shellExecutionEnd(e.instance.instanceId, e.data.command, e.data.exitCode);
55+
}));
5356

5457
// onDidChangeTerminalShellIntegration via cwd
5558
const cwdChangeEvent = this._store.add(this._terminalService.createOnInstanceCapabilityEvent(TerminalCapability.CwdDetection, e => e.onDidChangeCwd));

0 commit comments

Comments
 (0)