0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/mjsunit/test-process-spawn-loop.js
Ryan ad9d683f9f API: rename node.Process to node.ChildProcess
This is to avoid confusion with the global "process" object, especially for
the instances of node.Process.
2009-08-26 22:36:45 +02:00

28 lines
483 B
JavaScript

include("mjsunit.js");
var N = 40;
var finished = false;
function spawn (i) {
var child = node.createChildProcess('python -c "print 500 * 1024 * \'C\'"');
var output = "";
child.addListener("output", function(chunk) {
if (chunk) output += chunk;
});
child.addListener("exit", function () {
//puts(output);
if (i < N)
spawn(i+1);
else
finished = true;
});
}
spawn(0);
process.addListener("exit", function () {
assertTrue(finished);
});