aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src')
-rw-r--r--editors/code/src/net.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/editors/code/src/net.ts b/editors/code/src/net.ts
index 7c77530b8..866092882 100644
--- a/editors/code/src/net.ts
+++ b/editors/code/src/net.ts
@@ -1,8 +1,10 @@
1import fetch from "node-fetch"; 1import fetch from "node-fetch";
2import * as vscode from "vscode"; 2import * as vscode from "vscode";
3import * as stream from "stream"; 3import * as stream from "stream";
4import * as crypto from "crypto";
4import * as fs from "fs"; 5import * as fs from "fs";
5import * as util from "util"; 6import * as util from "util";
7import * as path from "path";
6import { log, assert } from "./util"; 8import { log, assert } from "./util";
7 9
8const pipeline = util.promisify(stream.pipeline); 10const pipeline = util.promisify(stream.pipeline);
@@ -68,7 +70,9 @@ interface DownloadOpts {
68export async function download(opts: DownloadOpts) { 70export async function download(opts: DownloadOpts) {
69 // Put artifact into a temporary file (in the same dir for simplicity) 71 // Put artifact into a temporary file (in the same dir for simplicity)
70 // to prevent partially downloaded files when user kills vscode 72 // to prevent partially downloaded files when user kills vscode
71 const tempFile = `${opts.dest}.tmp`; 73 const dest = path.parse(opts.dest);
74 const randomHex = crypto.randomBytes(5).toString("hex");
75 const tempFile = path.join(dest.dir, `${dest.name}${randomHex}`);
72 76
73 await vscode.window.withProgress( 77 await vscode.window.withProgress(
74 { 78 {