Permalink
Browse files

--chown option for run-script

  • Loading branch information...
cadorn committed Aug 23, 2012
1 parent 0220b23 commit 0320a6e64fd7701ed6a71570117fb4796bcfdc99
Showing with 9 additions and 0 deletions.
  1. +9 −0 lib/commands/run-script.js
@@ -10,6 +10,7 @@ var command = exports["run-script"] = new ARGS_PARSER();
command.help("Run a package/program script.");
command.arg("SCRIPT_NAME");
command.arg(".../[package.json|program.json]");
+command.option("--chown").set().help("Change ownership of process before running script.");
command.helpful();
command.action(function (options) {
@@ -21,6 +22,14 @@ command.action(function (options) {
return;
}
+ if (typeof options.chown !== "undefined") {
+
+ var ownership = options.chown.split(":");
+
+ process.setgid(parseInt(ownership[0]));
+ process.setuid(parseInt(ownership[1]));
+ }
+
PM.forProgramPath(basePath).then(function(pm) {
return PM.forPackagePath(null, pm).then(function(pm) {
return pm.runScript(options);

0 comments on commit 0320a6e

Please sign in to comment.