• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1if (module !== require.main) {
2  throw new Error("This file should not be loaded with require()")
3}
4
5if (!process.getuid || !process.getgid) {
6  throw new Error("this file should not be called without uid/gid support")
7}
8
9var argv = process.argv.slice(2)
10  , user = argv[0] || process.getuid()
11  , group = argv[1] || process.getgid()
12
13if (!isNaN(user)) user = +user
14if (!isNaN(group)) group = +group
15
16console.error([user, group])
17
18try {
19  process.setgid(group)
20  process.setuid(user)
21  console.log(JSON.stringify({uid:+process.getuid(), gid:+process.getgid()}))
22} catch (ex) {
23  console.log(JSON.stringify({error:ex.message,errno:ex.errno}))
24}
25