Skip to content

Commit 136d8f8

Browse files
committed
Switch to onDidStartTerminalShellExecution from the obsolete (proposed) API terminalData* events
1 parent 3c5e0f2 commit 136d8f8

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

Extension/.scripts/common.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,6 @@ export async function checkCompiled() {
324324
export async function checkDTS() {
325325
let failing = false;
326326
failing = !await assertAnyFile('vscode.d.ts') && (quiet || warn(`The VSCode import file '${$root}/dist/src/vscode.d.ts is missing.`)) || failing;
327-
failing = !await assertAnyFile('vscode.proposed.terminalDataWriteEvent.d.ts') && (quiet || warn(`The VSCode import file '${$root}/dist/src/vscode.proposed.terminalDataWriteEvent.d.ts is missing.`)) || failing;
328327
failing = !await assertAnyFile('vscode.proposed.lmTools.d.ts') && (quiet || warn(`The VSCode import file '${$root}/dist/src/vscode.proposed.lmTools.d.ts is missing.`)) || failing;
329328

330329
if (!failing) {

Extension/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
"Snippets"
4242
],
4343
"enabledApiProposals": [
44-
"terminalDataWriteEvent",
4544
"chatParticipantAdditions"
4645
],
4746
"capabilities": {
@@ -6651,4 +6650,4 @@
66516650
"postcss": "^8.4.31",
66526651
"gulp-typescript/**/glob-parent": "^5.1.2"
66536652
}
6654-
}
6653+
}

Extension/src/SSH/commandInteractors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,11 +372,11 @@ export class ComposedInteractor implements IInteractor {
372372
export interface ISystemInteractor {
373373
createTerminal(options: vscode.TerminalOptions): vscode.Terminal;
374374
onDidCloseTerminal: typeof vscode.window.onDidCloseTerminal;
375-
onDidWriteTerminalData: typeof vscode.window.onDidWriteTerminalData;
375+
onDidStartTerminalShellExecution: typeof vscode.window.onDidStartTerminalShellExecution;
376376
}
377377

378378
export const defaultSystemInteractor: ISystemInteractor = {
379379
createTerminal: vscode.window.createTerminal,
380380
onDidCloseTerminal: vscode.window.onDidCloseTerminal,
381-
onDidWriteTerminalData: vscode.window.onDidWriteTerminalData
381+
onDidStartTerminalShellExecution: vscode.window.onDidStartTerminalShellExecution
382382
};

Extension/src/SSH/sshCommandRunner.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ export function runInteractiveSshTerminalCommand(args: ITerminalCommandArgs): Pr
265265
let continueWithoutExiting: boolean = false;
266266

267267
const clean = () => {
268+
268269
if (terminalListener) {
269270
terminalListener.dispose();
270271
terminalListener = undefined;
@@ -343,17 +344,17 @@ export function runInteractiveSshTerminalCommand(args: ITerminalCommandArgs): Pr
343344
}
344345
};
345346

346-
const handleTerminalOutput = async (dataWrite: vscode.TerminalDataWriteEvent): Promise<void> => {
347+
const handleTerminalOutput = async (data: string): Promise<void> => {
347348
if (loggingLevel > 0) {
348-
handleOutputLogging(dataWrite.data);
349+
handleOutputLogging(data);
349350
}
350351

351352
if (continueWithoutExiting) {
352353
// Skip the interactors after we have continued since I haven't see a use case for now.
353354
return;
354355
}
355356

356-
stdout += dataWrite.data;
357+
stdout += data;
357358

358359
if (interactors) {
359360
for (const interactor of interactors) {
@@ -436,13 +437,14 @@ export function runInteractiveSshTerminalCommand(args: ITerminalCommandArgs): Pr
436437
hideFromUser: true
437438
};
438439

439-
let terminalDataHandlingQueue: Promise<void> = Promise.resolve();
440-
terminalListener = systemInteractor.onDidWriteTerminalData(async e => {
440+
terminalListener = systemInteractor.onDidStartTerminalShellExecution(async (e) => {
441441
if (e.terminal !== terminal) {
442442
return;
443443
}
444444

445-
terminalDataHandlingQueue = terminalDataHandlingQueue.finally(() => void handleTerminalOutput(e));
445+
for await (const data of e.execution.read()) {
446+
void handleTerminalOutput(data);
447+
}
446448
});
447449
terminal = systemInteractor.createTerminal(options);
448450

0 commit comments

Comments
 (0)