0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 15:30:56 +01:00
nodejs/test/mjsunit/test-process-spawn-loop.js
Felix Geisendörfer 530328f12b CommonJS testing for node.js
Refactored test suite to use the assert module for testing rather than
mjsunit.
2009-12-05 01:05:16 +01:00

34 lines
668 B
JavaScript

process.mixin(require("./common"));
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;
});
child.addListener("error", function(chunk) {
if (chunk) error(chunk)
});
child.addListener("exit", function () {
puts(output);
if (i < N)
spawn(i+1);
else
finished = true;
});
}
spawn(0);
process.addListener("exit", function () {
assert.equal(true, finished);
});