-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
programmatic examples #857
Comments
Is this what you're looking for ? |
I looked at that. It seems to indicate that the second argument to #start is a map of options, and that (I think) these are the options for passing arguments to the script: nodeArgs(arr), scriptArgs(arr)... yet, when I set those pm2.start('somescript.js', { name: 'test', scriptArgs : ['foo', 'bar'] } ...) I'm not catching them via process.argv in the target script. I'm assuming it is modeled like the second argument to child_process.fork('script', [args]). It doesn't seem to be. Thanks for the help. I fear i'm missing something obvious. |
I'm using When you're using I'm also seeing |
Thanks. After playing around with both solutions and reading the code closely I've achieved what I wanted to achieve. As the child (fork) process should have a communication channel (as per the node spec for #fork), I was wondering as well how to access that? To achieve something like the follow, where the forked process can send a message to its master: pm2.start(...,...,function(err, proc) {
proc.on('message', function(msg) { ... }
}) |
@sandro-pasquali any chance you could elaborate on the solution you came up with? |
Are there any programmatic examples that go into more depth? Specifically, how do I pass arguments to the target script -- i've tried nodeArgs, scriptArgs, env, node_args, script_args -- and i don't see those values anywhere in the process.
Great tool, looking forward to using it.
The text was updated successfully, but these errors were encountered: