diff options
Diffstat (limited to 'extension/src')
-rw-r--r-- | extension/src/activation/environmentSetup.ts | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/extension/src/activation/environmentSetup.ts b/extension/src/activation/environmentSetup.ts index 4394eb59..23c0d7de 100644 --- a/extension/src/activation/environmentSetup.ts +++ b/extension/src/activation/environmentSetup.ts @@ -103,7 +103,9 @@ async function checkOrKillRunningServer(serverUrl: string): Promise<boolean> { console.log("Failed to kill old server:", e); } } - fs.unlinkSync(serverVersionPath()); + if (fs.existsSync(serverVersionPath())) { + fs.unlinkSync(serverVersionPath()); + } // Also delete the server binary const serverBinaryPath = path.join( getExtensionUri().fsPath, @@ -148,7 +150,9 @@ export async function downloadFromS3( }); download.on("error", (err: any) => { - fs.unlink(destination, () => {}); + if (fs.existsSync(destination)) { + fs.unlink(destination, () => {}); + } throw err; }); @@ -205,11 +209,15 @@ export async function startContinuePythonServer(redownload: boolean = true) { shouldDownload = false; } else { console.log("Old version of the server downloaded"); - fs.unlinkSync(destination); + if (fs.existsSync(destination)) { + fs.unlinkSync(destination); + } } } else { console.log("Old version of the server downloaded"); - fs.unlinkSync(destination); + if (fs.existsSync(destination)) { + fs.unlinkSync(destination); + } } } |