"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/uid-number/get-uid-gid.js" (7 Feb 2017, 644 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 if (module !== require.main) {
    2   throw new Error("This file should not be loaded with require()")
    3 }
    4 
    5 if (!process.getuid || !process.getgid) {
    6   throw new Error("this file should not be called without uid/gid support")
    7 }
    8 
    9 var argv = process.argv.slice(2)
   10   , user = argv[0] || process.getuid()
   11   , group = argv[1] || process.getgid()
   12 
   13 if (!isNaN(user)) user = +user
   14 if (!isNaN(group)) group = +group
   15 
   16 console.error([user, group])
   17 
   18 try {
   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 }