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

34 lines
661 B
JavaScript
Raw Normal View History

process.mixin(require("common.js"));
var N = 40;
var finished = false;
function spawn (i) {
var child = process.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("error", function(chunk) {
if (chunk) error(chunk)
});
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);
});