mirror of
https://github.com/nodejs/node-v0.x-archive.git
synced 2026-04-28 03:01:10 -04:00
Instead directly call execvp(). This change is needed for the soon-to-be-added signal handlers because the /bin/sh parent process does not pass all signals to it's children, particularly SIGUSR1 on Linux. The parameters of createChildProcess had to be changed slightly. utils.exec() also has a changed implementation. A bug involving quoted arguments was knowingly introduced into utils.exec(). Will fix later.
34 lines
655 B
JavaScript
34 lines
655 B
JavaScript
node.mixin(require("common.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("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 () {
|
|
assertTrue(finished);
|
|
});
|