diff options
author | isaacs <i@izs.me> | 2011-02-07 13:02:09 +0300 |
---|---|---|
committer | isaacs <i@izs.me> | 2011-02-08 04:09:06 +0300 |
commit | ec2aa21c516664266357bb17e659fa4cbbed878a (patch) | |
tree | 0da34d9fd328db9da07a0037a6dede167a52979a /bin | |
parent | 6a345a03868a042f55a17239976ffedb8e2c69ea (diff) |
Report the error, rather than just failing badly.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/npm-get-uid-gid.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/bin/npm-get-uid-gid.js b/bin/npm-get-uid-gid.js index 99b0d702a..390e0f2fc 100644 --- a/bin/npm-get-uid-gid.js +++ b/bin/npm-get-uid-gid.js @@ -5,11 +5,12 @@ var argv = process.argv.slice(2) if (!isNaN(user)) user = +user if (!isNaN(group)) group = +group - console.error([user, group]) - -process.setgid(group) -process.setuid(user) - -console.log(JSON.stringify({uid:+process.getuid(), gid:+process.getgid()})) +try { + process.setgid(group) + process.setuid(user) + console.log(JSON.stringify({uid:+process.getuid(), gid:+process.getgid()})) +} catch (ex) { + console.log(JSON.stringify({error:ex.message,errno:ex.errno})) +} |