From 402ef08eddd1424e162ac8c19e7dbf1b77e516db Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Sat, 3 Feb 2018 15:25:46 +0200 Subject: [PATCH] fix: don't try to rename folder after exception --- src/createDownloader.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/createDownloader.ts b/src/createDownloader.ts index 39fbd5573d..adbb8c2630 100644 --- a/src/createDownloader.ts +++ b/src/createDownloader.ts @@ -166,6 +166,10 @@ export default ( }), waitTillClosed({ stream, size, getDownloaded: () => downloaded, url }), ]) + .then((vals) => { + return renameOverwrite(stage, opts.unpackTo) + .then(() => resolve(vals[1])) + }) .catch((err) => { rimraf(stage, (err) => { // Just ignoring this error @@ -173,10 +177,6 @@ export default ( }) reject(err) }) - .then((vals) => { - return renameOverwrite(stage, opts.unpackTo) - .then(() => resolve(vals[1])) - }) }) } catch (err) { err.attempts = currentAttempt