aboutsummaryrefslogtreecommitdiff
path: root/deps/npm/lib/utils/correct-mkdir.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/lib/utils/correct-mkdir.js')
-rw-r--r--deps/npm/lib/utils/correct-mkdir.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/deps/npm/lib/utils/correct-mkdir.js b/deps/npm/lib/utils/correct-mkdir.js
index c0a31bdc58..68c4a4ad79 100644
--- a/deps/npm/lib/utils/correct-mkdir.js
+++ b/deps/npm/lib/utils/correct-mkdir.js
@@ -43,8 +43,13 @@ function calculateOwner () {
if (!effectiveOwner) {
effectiveOwner = { uid: 0, gid: 0 }
- if (process.getuid) effectiveOwner.uid = +process.getuid()
- if (process.getgid) effectiveOwner.gid = +process.getgid()
+ // Pretty much only on windows
+ if (!process.getuid) {
+ return effectiveOwner
+ }
+
+ effectiveOwner.uid = +process.getuid()
+ effectiveOwner.gid = +process.getgid()
if (effectiveOwner.uid === 0) {
if (process.env.SUDO_UID) effectiveOwner.uid = +process.env.SUDO_UID
@@ -112,6 +117,7 @@ function makeDirectory (path, cb) {
function setPermissions (path, st, cb) {
chownr(path, st.uid, st.gid, function (er) {
+ if (er && er.code === 'ENOENT') return cb(null, st)
return cb(er, st)
})
}