mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
Append 10 random hex chars to temp artifact files
This commit is contained in:
parent
62ebaa822b
commit
c1d39571c9
1 changed files with 5 additions and 1 deletions
|
@ -1,8 +1,10 @@
|
||||||
import fetch from "node-fetch";
|
import fetch from "node-fetch";
|
||||||
import * as vscode from "vscode";
|
import * as vscode from "vscode";
|
||||||
import * as stream from "stream";
|
import * as stream from "stream";
|
||||||
|
import * as crypto from "crypto";
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import * as util from "util";
|
import * as util from "util";
|
||||||
|
import * as path from "path";
|
||||||
import { log, assert } from "./util";
|
import { log, assert } from "./util";
|
||||||
|
|
||||||
const pipeline = util.promisify(stream.pipeline);
|
const pipeline = util.promisify(stream.pipeline);
|
||||||
|
@ -68,7 +70,9 @@ interface DownloadOpts {
|
||||||
export async function download(opts: DownloadOpts) {
|
export async function download(opts: DownloadOpts) {
|
||||||
// Put artifact into a temporary file (in the same dir for simplicity)
|
// Put artifact into a temporary file (in the same dir for simplicity)
|
||||||
// to prevent partially downloaded files when user kills vscode
|
// to prevent partially downloaded files when user kills vscode
|
||||||
const tempFile = `${opts.dest}.tmp`;
|
const dest = path.parse(opts.dest);
|
||||||
|
const randomHex = crypto.randomBytes(5).toString("hex");
|
||||||
|
const tempFile = path.join(dest.dir, `${dest.name}${randomHex}`);
|
||||||
|
|
||||||
await vscode.window.withProgress(
|
await vscode.window.withProgress(
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue