Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Extension/.scripts/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@ export async function checkCompiled() {
export async function checkDTS() {
let failing = false;
failing = !await assertAnyFile('vscode.d.ts') && (quiet || warn(`The VSCode import file '${$root}/dist/src/vscode.d.ts is missing.`)) || failing;
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;
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;

if (!failing) {
Expand Down
3 changes: 1 addition & 2 deletions Extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"Snippets"
],
"enabledApiProposals": [
"terminalDataWriteEvent",
"chatParticipantAdditions"
],
"capabilities": {
Expand Down Expand Up @@ -6651,4 +6650,4 @@
"postcss": "^8.4.31",
"gulp-typescript/**/glob-parent": "^5.1.2"
}
}
}
4 changes: 2 additions & 2 deletions Extension/src/SSH/commandInteractors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,11 @@ export class ComposedInteractor implements IInteractor {
export interface ISystemInteractor {
createTerminal(options: vscode.TerminalOptions): vscode.Terminal;
onDidCloseTerminal: typeof vscode.window.onDidCloseTerminal;
onDidWriteTerminalData: typeof vscode.window.onDidWriteTerminalData;
onDidStartTerminalShellExecution: typeof vscode.window.onDidStartTerminalShellExecution;
}

export const defaultSystemInteractor: ISystemInteractor = {
createTerminal: vscode.window.createTerminal,
onDidCloseTerminal: vscode.window.onDidCloseTerminal,
onDidWriteTerminalData: vscode.window.onDidWriteTerminalData
onDidStartTerminalShellExecution: vscode.window.onDidStartTerminalShellExecution
};
14 changes: 8 additions & 6 deletions Extension/src/SSH/sshCommandRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ export function runInteractiveSshTerminalCommand(args: ITerminalCommandArgs): Pr
let continueWithoutExiting: boolean = false;

const clean = () => {

if (terminalListener) {
terminalListener.dispose();
terminalListener = undefined;
Expand Down Expand Up @@ -343,17 +344,17 @@ export function runInteractiveSshTerminalCommand(args: ITerminalCommandArgs): Pr
}
};

const handleTerminalOutput = async (dataWrite: vscode.TerminalDataWriteEvent): Promise<void> => {
const handleTerminalOutput = async (data: string): Promise<void> => {
if (loggingLevel > 0) {
handleOutputLogging(dataWrite.data);
handleOutputLogging(data);
}

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

stdout += dataWrite.data;
stdout += data;

if (interactors) {
for (const interactor of interactors) {
Expand Down Expand Up @@ -436,13 +437,14 @@ export function runInteractiveSshTerminalCommand(args: ITerminalCommandArgs): Pr
hideFromUser: true
};

let terminalDataHandlingQueue: Promise<void> = Promise.resolve();
terminalListener = systemInteractor.onDidWriteTerminalData(async e => {
terminalListener = systemInteractor.onDidStartTerminalShellExecution(async (e) => {
if (e.terminal !== terminal) {
return;
}

terminalDataHandlingQueue = terminalDataHandlingQueue.finally(() => void handleTerminalOutput(e));
for await (const data of e.execution.read()) {
void handleTerminalOutput(data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be void handleTerminalOutput(data).catch(logAndReturn.undefined);?

}
});
terminal = systemInteractor.createTerminal(options);

Expand Down