Skip to content

Commit

Permalink
Pipe output directly
Browse files Browse the repository at this point in the history
Fixes #68.
  • Loading branch information
iangreenleaf committed Sep 10, 2012
1 parent 34c3d6b commit fd105ac
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/supervisor.js
Expand Up @@ -186,9 +186,12 @@ function help () {
function startProgram (prog, exec) { function startProgram (prog, exec) {
util.debug("Starting child process with '" + exec + " " + prog.join(" ") + "'"); util.debug("Starting child process with '" + exec + " " + prog.join(" ") + "'");
crash_queued = false; crash_queued = false;
var child = exports.child = spawn(exec, prog); var child = exports.child = spawn(exec, prog, {stdio: 'inherit'});
child.stdout.addListener("data", function (chunk) { chunk && util.print(chunk); }); if (child.stdout) {
child.stderr.addListener("data", function (chunk) { chunk && util.debug(chunk); }); // node < 0.8 doesn't understand the 'inherit' option, so pass through manually
child.stdout.addListener("data", function (chunk) { chunk && util.print(chunk); });
child.stderr.addListener("data", function (chunk) { chunk && util.debug(chunk); });
}
child.addListener("exit", function (code) { child.addListener("exit", function (code) {
if (!crash_queued) { if (!crash_queued) {
util.debug("Program " + exec + " " + prog.join(" ") + " exited with code " + code + "\n"); util.debug("Program " + exec + " " + prog.join(" ") + " exited with code " + code + "\n");
Expand Down

0 comments on commit fd105ac

Please sign in to comment.