On Thu, Jun 21, 2012 at 1:55 PM, Oliver Leics <[email protected]> wrote:
> Hallo
>
> I want to be able to run a nodejs-script within a "master"
> node-process, a node-script that I normally start with
> child_process.fork().
>
> What I'm struggling with is process.argv
>
> For example, is it possible to run the script via the vm-module and
> set process.argv only for this script?
> Or can I somehow utilize the domain-module to set process.argv only
> for this script?
>
> Any other ideas? Or does anyone know a npm-package for that?
The vm module will let you do that. Example:
$ node -pe '
> var util = require("util");
> var vm = require("vm");
> var process_ = util._extend(process, {argv:["foo","bar"]});
> vm.runInNewContext("process.argv", {process:process_});
> '
[ 'foo', 'bar' ]
util._extend() is an internal function but you get the idea.
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en