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

28 lines
446 B
JavaScript
Raw Normal View History

include("mjsunit.js");
var N = 40;
var finished = false;
function spawn (i) {
var p = node.createProcess('python -c "print 500 * 1024 * \'C\'"');
var output = "";
2009-06-29 19:18:30 +08:00
p.addListener("output", function(chunk) {
if (chunk) output += chunk;
2009-06-28 02:40:43 +08:00
});
2009-06-29 19:18:30 +08:00
p.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);
function onExit () {
assertTrue(finished);
}