Skip to content

Commit 4ea5c67

Browse files
committed
fix after feedback
1 parent c1a51ad commit 4ea5c67

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/client/common/terminal/service.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export class TerminalService implements ITerminalService, Disposable {
9999

100100
if (terminal.shellIntegration) {
101101
const execution = terminal.shellIntegration.executeCommand(commandLine);
102-
return await Promise.race([
102+
const result = await Promise.race([
103103
new Promise<ITerminalExecutedCommand>((resolve) => {
104104
const listener = this.terminalManager.onDidEndTerminalShellExecution((e) => {
105105
if (e.execution === execution) {
@@ -112,16 +112,20 @@ export class TerminalService implements ITerminalService, Disposable {
112112
}
113113
traceVerbose(`Shell Integration is enabled, executeCommand: ${commandLine}`);
114114
}),
115-
// Once shell integration is active, hearing back from onDidEndTerminalShellExecution should not take too long.
116115
new Promise<undefined>((resolve) => {
117116
setTimeout(() => {
118-
traceVerbose(`Execution timed out, falling back to sendText: ${commandLine}`);
119-
terminal.sendText(commandLine);
120117
resolve(undefined);
121-
return undefined;
122118
}, 5000);
123119
}),
124120
]);
121+
122+
if (result === undefined) {
123+
traceVerbose(`Execution timed out, falling back to sendText: ${commandLine}`);
124+
terminal.sendText(commandLine);
125+
return undefined;
126+
} else {
127+
return result;
128+
}
125129
} else {
126130
terminal.sendText(commandLine);
127131
traceVerbose(`Shell Integration is disabled, sendText: ${commandLine}`);

0 commit comments

Comments
 (0)