Skip to content
This repository has been archived by the owner on Jul 3, 2019. It is now read-only.

Commit

Permalink
fix(put-stream): use new promise API for moves
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Feb 28, 2017
1 parent 5cf4616 commit 1d36013
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions lib/content/put-stream.js
Expand Up @@ -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)
})
Expand Down

0 comments on commit 1d36013

Please sign in to comment.