diff options
author | isaacs <i@izs.me> | 2011-01-26 00:15:00 +0300 |
---|---|---|
committer | isaacs <i@izs.me> | 2011-02-08 04:09:05 +0300 |
commit | 6001bf060eadd4e970becde04656d556fe5fdbf6 (patch) | |
tree | af7603b69a288655f6886128072b419da7627380 /bin | |
parent | 074ba6251a0baa5495f7c20fb66832f0edfae593 (diff) |
Numeric UID/GID values, and remove the script runner
Since node can run scripts as a uid/gid anyway, the script runner is
unnecessary. Numberizing the uid and gid make them suitable as
arguments to chown.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/npm-script-runner.js | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/bin/npm-script-runner.js b/bin/npm-script-runner.js deleted file mode 100644 index cf2e8147f..000000000 --- a/bin/npm-script-runner.js +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env node - -// Run a command as a specific user. -// env is passed through untouched. -// usage: npm-script-runner $folder $uid $gid "make test" -// This is internal plumbing - -var argv = process.argv.slice(2) - , cwd = argv.shift() - , uid = argv.shift() - , gid = argv.shift() - , cmd = argv.shift() - , stdio = process.binding("stdio") - , cp = require("child_process") - -if (!isNaN(uid)) uid = +uid -if (!isNaN(gid)) gid = +gid - -if (!uid || !gid || uid === "root") throw new Error( - "Please set a non-zero/non-root uid and gid") - -console.error("uid=%s gid=%s euid=%s egid=%s" - , process.getuid(), process.getgid(), uid, gid) -console.error("cmd=%s", cmd) -process.setgid(gid) -process.setuid(uid) - -cp.spawn( "sh", ["-c", cmd] - , { env : process.env - , cwd : cwd - , customFds: [ stdio.stdinFD - , stdio.stdoutFD - , stdio.stderrFD ] - } ) - .on("exit", function (c) { process.exit(c) }) |