From a5f15f23196b048ab3d5e0197c6bff50afdc7a7d Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Mon, 25 Oct 2021 12:29:40 +0800 Subject: [PATCH] Fix #793, check dist-backup existing before delete --- extra/download-dist.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/extra/download-dist.js b/extra/download-dist.js index 0a08b7f90..dc64166c4 100644 --- a/extra/download-dist.js +++ b/extra/download-dist.js @@ -34,9 +34,11 @@ function download(url) { }); tarStream.on("close", () => { - fs.rmdirSync("./dist-backup", { - recursive: true - }); + if (fs.existsSync("./dist-backup")) { + fs.rmdirSync("./dist-backup", { + recursive: true + }); + } console.log("Done"); }); @@ -44,7 +46,7 @@ function download(url) { if (fs.existsSync("./dist-backup")) { fs.renameSync("./dist-backup", "./dist"); } - console.log("Done"); + console.error("Error from tarStream"); }); response.pipe(tarStream);