From 0e9be6ff11af29ebfb9b8db39f83f4d7a235790b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Scha=CC=88fer?= <101886095+PeterSchafer@users.noreply.github.com> Date: Wed, 8 Feb 2023 17:24:50 +0100 Subject: [PATCH] feat: use date to create filename to avoid issues with randomInt() --- ts-binary-wrapper/src/common.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ts-binary-wrapper/src/common.ts b/ts-binary-wrapper/src/common.ts index 137d6ad6f1..b939855160 100644 --- a/ts-binary-wrapper/src/common.ts +++ b/ts-binary-wrapper/src/common.ts @@ -3,7 +3,7 @@ import * as os from 'os'; import * as fs from 'fs'; import { spawnSync } from 'child_process'; import * as https from 'https'; -import { randomInt, createHash } from 'crypto'; +import { createHash } from 'crypto'; export const versionFile = path.join(__dirname, 'generated', 'version'); export const shasumFile = path.join(__dirname, 'generated', 'sha256sums.txt'); @@ -198,7 +198,7 @@ export function downloadExecutable( ): Promise { return new Promise(function(resolve) { const options = new URL(downloadUrl); - const temp = path.join(__dirname, randomInt(100000).toString()); + const temp = path.join(__dirname, Date.now().toString()); const fileStream = fs.createWriteStream(temp); const cleanupAfterError = (exitCode: number) => {