From 1d36013d8f675f7ff0059d9705348dcb5f0a7dba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Mon, 27 Feb 2017 14:18:21 -0800 Subject: [PATCH] fix(put-stream): use new promise API for moves --- lib/content/put-stream.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/lib/content/put-stream.js b/lib/content/put-stream.js index a460d87..b8504f5 100644 --- a/lib/content/put-stream.js +++ b/lib/content/put-stream.js @@ -133,18 +133,10 @@ function moveToDestination (tmpTarget, cache, digest, opts, errCheck) { return fixOwner.mkdirfix( destDir, opts.uid, opts.gid - ).then(() => ( - new Promise((resolve, reject) => { - errCheck() - moveFile(tmpTarget, destination, err => { - if (err) { - reject(err) - } else { - resolve() - } - }) - }) - )).then(() => { + ).then(() => { + errCheck() + return moveFile(tmpTarget, destination) + }).then(() => { errCheck() return fixOwner.chownr(destination, opts.uid, opts.gid) })