summaryrefslogtreecommitdiff
path: root/extension/src/activation
diff options
context:
space:
mode:
authorNate Sesti <sestinj@gmail.com>2023-07-15 21:55:47 -0700
committerNate Sesti <sestinj@gmail.com>2023-07-15 21:55:47 -0700
commit8e96e0ee4a1c251d20577769bfcb76dbc7b043a2 (patch)
treee846def81035c99dec96c7fa0b7d233da834e022 /extension/src/activation
parent57e504452e6d13f903c384544fd6a3836e3ddb99 (diff)
downloadsncontinue-8e96e0ee4a1c251d20577769bfcb76dbc7b043a2.tar.gz
sncontinue-8e96e0ee4a1c251d20577769bfcb76dbc7b043a2.tar.bz2
sncontinue-8e96e0ee4a1c251d20577769bfcb76dbc7b043a2.zip
fixed reading of terminal and other vscode windows
Diffstat (limited to 'extension/src/activation')
-rw-r--r--extension/src/activation/environmentSetup.ts54
1 files changed, 27 insertions, 27 deletions
diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts
index 928fe04b..df609a34 100644
--- a/extension/src/activation/environmentSetup.ts
+++ b/extension/src/activation/environmentSetup.ts
@@ -260,34 +260,34 @@ async function createPythonVenv(pythonCmd: string) {
await vscode.window.showErrorMessage(msg);
} else if (checkEnvExists()) {
console.log("Successfully set up python env at ", `${serverPath()}/env`);
+ } else if (
+ stderr?.includes("Permission denied") &&
+ stderr?.includes("python.exe")
+ ) {
+ // This might mean that another window is currently using the python.exe file to install requirements
+ // So we want to wait and try again
+ let i = 0;
+ await new Promise((resolve, reject) =>
+ setInterval(() => {
+ if (i > 5) {
+ reject("Timed out waiting for other window to create env...");
+ }
+ if (checkEnvExists()) {
+ resolve(null);
+ } else {
+ console.log("Waiting for other window to create env...");
+ }
+ i++;
+ }, 5000)
+ );
} else {
- try {
- // This might mean that another window is currently using the python.exe file to install requirements
- // So we want to wait and try again
- let i = 0;
- await new Promise((resolve, reject) =>
- setInterval(() => {
- if (i > 5) {
- reject();
- }
- if (checkEnvExists()) {
- resolve(null);
- } else {
- console.log("Waiting for other window to create env...");
- }
- i++;
- }, 5000)
- );
- } catch (e) {
- const msg = [
- "Python environment not successfully created. Trying again. Here was the stdout + stderr: ",
- `stdout: ${stdout}`,
- `stderr: ${stderr}`,
- `e: ${e}`,
- ].join("\n\n");
- console.log(msg);
- throw new Error(msg);
- }
+ const msg = [
+ "Python environment not successfully created. Trying again. Here was the stdout + stderr: ",
+ `stdout: ${stdout}`,
+ `stderr: ${stderr}`,
+ ].join("\n\n");
+ console.log(msg);
+ throw new Error(msg);
}
}
}