Skip to content

Commit 8bb8bfb

Browse files
committed
Add small timeout to avoid ctrl+c on Windows
1 parent 2693262 commit 8bb8bfb

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/features/pythonApi.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ import { runInBackground } from './execution/runInBackground';
4949
import { EnvVarManager } from './execution/envVariableManager';
5050
import { checkUri } from '../common/utils/pathUtils';
5151
import { waitForAllEnvManagers, waitForEnvManager, waitForEnvManagerId } from './common/managerReady';
52+
import { timeout } from '../common/utils/asyncUtils';
53+
import { isWindows } from '../common/utils/platformUtils';
5254

5355
class PythonEnvironmentApiImpl implements PythonEnvironmentApi {
5456
private readonly _onDidChangeEnvironments = new EventEmitter<DidChangeEnvironmentsEventArgs>();
@@ -304,6 +306,12 @@ class PythonEnvironmentApiImpl implements PythonEnvironmentApi {
304306
options.cwd instanceof Uri ? options.cwd : Uri.file(options.cwd),
305307
environment,
306308
);
309+
if (isWindows()) {
310+
// Since we have extra polliing on Windows that could lead to race stale promptInputModel value,
311+
// temporarily add small timeout to avoid ^C.
312+
// TODO: Consider removing when we clean up polling with newer conpty: https://github.com/microsoft/vscode/issues/224488
313+
await timeout(50);
314+
}
307315
await runInTerminal(environment, terminal, options);
308316
return terminal;
309317
}

0 commit comments

Comments
 (0)