Skip to content

Commit 8fb2e24

Browse files
committed
fix test, {} to undefined
1 parent 4ea5c67 commit 8fb2e24

File tree

2 files changed

+13
-21
lines changed

2 files changed

+13
-21
lines changed

src/client/common/terminal/service.ts

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -99,32 +99,23 @@ export class TerminalService implements ITerminalService, Disposable {
9999

100100
if (terminal.shellIntegration) {
101101
const execution = terminal.shellIntegration.executeCommand(commandLine);
102-
const result = await Promise.race([
103-
new Promise<ITerminalExecutedCommand>((resolve) => {
104-
const listener = this.terminalManager.onDidEndTerminalShellExecution((e) => {
102+
103+
let result = undefined;
104+
let disposable: Disposable | undefined;
105+
try {
106+
result = await new Promise<ITerminalExecutedCommand>((resolve) => {
107+
disposable = this.terminalManager.onDidEndTerminalShellExecution((e) => {
105108
if (e.execution === execution) {
106-
this.executeCommandListeners.delete(listener);
107109
resolve({ execution, exitCode: e.exitCode });
108110
}
109111
});
110-
if (listener) {
111-
this.executeCommandListeners.add(listener);
112-
}
113-
traceVerbose(`Shell Integration is enabled, executeCommand: ${commandLine}`);
114-
}),
115-
new Promise<undefined>((resolve) => {
116-
setTimeout(() => {
117-
resolve(undefined);
118-
}, 5000);
119-
}),
120-
]);
121112

122-
if (result === undefined) {
123-
traceVerbose(`Execution timed out, falling back to sendText: ${commandLine}`);
124-
terminal.sendText(commandLine);
125-
return undefined;
126-
} else {
113+
traceVerbose(`Shell Integration is enabled, executeCommand: ${commandLine}`);
114+
});
127115
return result;
116+
} catch {
117+
} finally {
118+
disposable?.dispose();
128119
}
129120
} else {
130121
terminal.sendText(commandLine);
@@ -148,7 +139,6 @@ export class TerminalService implements ITerminalService, Disposable {
148139
this.terminalShellType = this.terminalHelper.identifyTerminalShell(this.terminal);
149140
this.terminal = this.terminalManager.createTerminal({
150141
name: this.options?.title || 'Python',
151-
env: {},
152142
hideFromUser: this.options?.hideFromUser,
153143
});
154144
this.terminalAutoActivator.disableAutoActivation(this.terminal);

src/test/smoke/smartSend.smoke.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ suite('Smoke Test: Run Smart Selection and Advance Cursor', async () => {
2323
const configuration = vscode.workspace.getConfiguration('python');
2424
await configuration.update('REPL.sendToNativeREPL', false, vscode.ConfigurationTarget.Global);
2525

26+
// TODO: change default setting to pwsh for this test
27+
2628
const file = path.join(
2729
EXTENSION_ROOT_DIR_FOR_TESTS,
2830
'src',

0 commit comments

Comments
 (0)