If we fork a child_process in Node, how can we pass node parameters to the child_process?
https://nodejs.org/api/child_process.html
Specifically I would like to spawn ~20 processes, and would like to limit the memory usage of each by using --v8-options, but I can't find any examples of doing this - is this possible or do the child processes assume the same node parameters as the parent?
the parent would be:
node foo.js
and the children would be
node --some-flag=bar baz.js
...
I am looking to pass node options using
child_process.fork()
but if it's only possible with
spawn()
or
exec()
then I guess I will take what I can get.
As a simple example, the following will not run Node.js with the --harmony flag
var cp = require('child_process');
var args = ['--harmony'];
var n = cp.fork(filePath, args , Object.create(process.env));