From 9517cd7eb2d2b00937121d88028c871f7896c23c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Sat, 25 Feb 2017 11:29:39 -0800 Subject: [PATCH] feat(util): promise-inflight ownership fix requests --- lib/util/fix-owner.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/util/fix-owner.js b/lib/util/fix-owner.js index 3091398..7bedebc 100644 --- a/lib/util/fix-owner.js +++ b/lib/util/fix-owner.js @@ -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) { @@ -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() + ) ) }