node/deps/npm/lib/config/load-uid.js
Rebecca Turner 41923c0c07 deps: upgrade npm to 3.3.6
PR-URL: https://github.com/nodejs/node/pull/3310
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-10-22 13:56:09 -04:00

16 lines
386 B
JavaScript

module.exports = loadUid
var getUid = require('uid-number')
// Call in the context of a npmconf object
function loadUid (cb) {
// if we're not in unsafe-perm mode, then figure out who
// to run stuff as. Do this first, to support `npm update npm -g`
if (!this.get('unsafe-perm')) {
getUid(this.get('user'), this.get('group'), cb)
} else {
process.nextTick(cb)
}
}