Skip to content

Commit

Permalink
lib: ignore non-critical os.userInfo() failures
Browse files Browse the repository at this point in the history
Fixes: #1834
PR-URL: #1835
  • Loading branch information
rvagg committed Sep 26, 2019
1 parent 785e527 commit 1186e89
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,12 @@ function install (fs, gyp, argv, callback) {
}
var tmpdir = os.tmpdir()
gyp.devDir = path.resolve(tmpdir, '.node-gyp')
log.warn('EACCES', 'user "%s" does not have permission to access the dev dir "%s"', os.userInfo().username, devDir)
var userString = ''
try {
// os.userInfo can fail on some systems, it's not critical here
userString = ` ("${os.userInfo().username}")`
} catch (e) {}
log.warn('EACCES', 'current user%s does not have permission to access the dev dir "%s"', userString, devDir)
log.warn('EACCES', 'attempting to reinstall using temporary dev dir "%s"', gyp.devDir)
if (process.cwd() === tmpdir) {
log.verbose('tmpdir == cwd', 'automatically will remove dev files after to save disk space')
Expand Down

0 comments on commit 1186e89

Please sign in to comment.