diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-07-15 21:55:47 -0700 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-07-15 21:55:47 -0700 |
commit | 53536dce999f2858102b7bf969824141140c5fc7 (patch) | |
tree | 11818d23ff654c876c419c7fad20768738204f95 /extension/src/activation | |
parent | 1cc788de843169400d70f26e533417f3a0a95b29 (diff) | |
download | sncontinue-53536dce999f2858102b7bf969824141140c5fc7.tar.gz sncontinue-53536dce999f2858102b7bf969824141140c5fc7.tar.bz2 sncontinue-53536dce999f2858102b7bf969824141140c5fc7.zip |
fixed reading of terminal and other vscode windows
Diffstat (limited to 'extension/src/activation')
-rw-r--r-- | extension/src/activation/environmentSetup.ts | 54 |
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); } } } |