Yeah. spawn() creates completely new processes at the OS level.
And you can simplify it a bit using pipe() :
var spawn = require("child_process").spawn , children = [ 'server1', 'server2', 'server3' ] , child children.forEach(function(name) { child = spawn("node", [name] ) child.stdout.pipe(process.stdout); child.stderr.pipe(process.stderr);
(An exit listener has also been added, so it will somehow propagate errors. If this is something you want to do, you can track them until the last process is complete, and then call process.exit() with the most big or smallest code ...)
source share