From c7f464774901d40483a6edc4f1294e1648dee4d5 Mon Sep 17 00:00:00 2001 From: Matthias Einwag Date: Wed, 23 Sep 2020 08:37:02 -0700 Subject: Move unlink on download into download function Since this is required by all callsites its easier to have it in the function itself. --- editors/code/src/main.ts | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'editors/code/src/main.ts') diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index f865639a1..2896d90ac 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts @@ -200,15 +200,11 @@ async function bootstrapExtension(config: Config, state: PersistentState): Promi const dest = path.join(config.globalStoragePath, "rust-analyzer.vsix"); await downloadWithRetryDialog(state, async () => { - // Unlinking the exe file before moving new one on its place should prevent ETXTBSY error. - await fs.unlink(dest).catch(err => { - if (err.code !== "ENOENT") throw err; - }); - await download({ url: artifact.browser_download_url, dest, progressTitle: "Downloading rust-analyzer extension", + overwrite: true, }); }); @@ -330,17 +326,13 @@ async function getServer(config: Config, state: PersistentState): Promise { - // Unlinking the exe file before moving new one on its place should prevent ETXTBSY error. - await fs.unlink(dest).catch(err => { - if (err.code !== "ENOENT") throw err; - }); - await download({ url: artifact.browser_download_url, dest, progressTitle: "Downloading rust-analyzer server", gunzip: true, - mode: 0o755 + mode: 0o755, + overwrite: true, }); }); -- cgit v1.2.3