fix: tauri init may failed with no error message. (fix #2079) (#2117)

Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
This commit is contained in:
LisiurDay
2021-06-30 20:26:49 +08:00
committed by GitHub
parent f03eea9c9b
commit fd0334645b
2 changed files with 9 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"cli.js": patch
---
Throw error on `cli.rs` download failure instead of silent exit.

View File

@@ -40,7 +40,10 @@ async function downloadBinaryRelease(
// TODO: Check hash of download
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, security/detect-non-literal-fs-filename
await pipeline(got.stream(url), fs.createWriteStream(outPath)).catch((e) => {
removeDownloadedCliIfNeeded()
try {
// eslint-disable-next-line security/detect-non-literal-fs-filename
fs.unlinkSync(outPath)
} catch {}
throw e
})
// eslint-disable-next-line security/detect-object-injection