Skip to content

Commit

Permalink
[DEV] Update from old process.createChildProcess() to new child_proce…
Browse files Browse the repository at this point in the history
…ss.spawn() API.
  • Loading branch information
rentzsch committed May 1, 2010
1 parent a52e02e commit 825fbb8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/supervisor.js
@@ -1,6 +1,7 @@

var sys = require("sys");
var fs = require("fs");
var spawn = require("child_process").spawn;

exports.run = run;

Expand Down Expand Up @@ -54,9 +55,9 @@ function help () {

function startProgram (prog) {
sys.debug("Starting child: "+prog);
var child = exports.child = process.createChildProcess("node", [prog]);
child.addListener("output", function (chunk) { chunk && sys.print(chunk) });
child.addListener("error", function (chunk) { chunk && process.stdio.writeError(chunk) });
var child = exports.child = spawn("node", [prog]);
child.stdout.addListener("data", function (chunk) { chunk && sys.print(chunk) });
child.stderr.addListener("data", function (chunk) { chunk && sys.debug(chunk) });
child.addListener("exit", function () { startProgram(prog) });
}

Expand Down

0 comments on commit 825fbb8

Please sign in to comment.