diff options
| author | Nate Sesti <sestinj@gmail.com> | 2023-08-24 11:41:37 -0700 | 
|---|---|---|
| committer | Nate Sesti <sestinj@gmail.com> | 2023-08-24 11:41:37 -0700 | 
| commit | f6cb7a1c3eda6bdbcce3fbd89e8d019e87c4a7a4 (patch) | |
| tree | 2097047d5ef061e36d53913d2df24e89296df952 /extension/src | |
| parent | 243a0b91e3956a9cd61f17f6b5eeb7a41a56d6c9 (diff) | |
| download | sncontinue-f6cb7a1c3eda6bdbcce3fbd89e8d019e87c4a7a4.tar.gz sncontinue-f6cb7a1c3eda6bdbcce3fbd89e8d019e87c4a7a4.tar.bz2 sncontinue-f6cb7a1c3eda6bdbcce3fbd89e8d019e87c4a7a4.zip | |
fix unlink
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); +      }      }    } | 
