node/test/mjsunit/test-process-spawn-loop.js

28 lines
483 B
JavaScript
Raw Normal View History

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;
2009-08-27 04:03:19 +08:00
});
child.addListener("exit", function () {
//puts(output);
if (i < N)
spawn(i+1);
else
finished = true;
2009-06-28 02:40:43 +08:00
});
}
2009-08-27 00:22:00 +08:00
spawn(0);
process.addListener("exit", function () {
assertTrue(finished);
});