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

Commit

Permalink
feat(util): promise-inflight ownership fix requests
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Feb 27, 2017
1 parent c52c487 commit 9517cd7
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions lib/util/fix-owner.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const Promise = require('bluebird')

const chownr = Promise.promisify(require('chownr'))
const mkdirp = Promise.promisify(require('mkdirp'))
const inflight = require('promise-inflight')

module.exports.chownr = fixOwner
function fixOwner (filepath, uid, gid) {
Expand All @@ -20,17 +21,13 @@ function fixOwner (filepath, uid, gid) {
// No need to override if it's already what we used.
return Promise.resolve()
}
// cb = inflight('fixOwner: fixing ownership on ' + filepath, cb)
// if (!cb) {
// // We're inflight! whoosh!
// return
// }

// *now* we override perms
return chownr(
filepath,
typeof uid === 'number' ? uid : process.getuid(),
typeof gid === 'number' ? gid : process.getgid()
return inflight(
'fixOwner: fixing ownership on ' + filepath,
() => chownr(
filepath,
typeof uid === 'number' ? uid : process.getuid(),
typeof gid === 'number' ? gid : process.getgid()
)
)
}

Expand Down

0 comments on commit 9517cd7

Please sign in to comment.