mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +00:00
Move unlink on download into download function
Since this is required by all callsites its easier to have it in the function itself.
This commit is contained in:
parent
df4d59512e
commit
c7f4647749
2 changed files with 11 additions and 11 deletions
|
@ -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<string
|
|||
assert(!!artifact, `Bad release: ${JSON.stringify(release)}`);
|
||||
|
||||
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 server",
|
||||
gunzip: true,
|
||||
mode: 0o755
|
||||
mode: 0o755,
|
||||
overwrite: true,
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue