Permalink
Browse files

[DEV] Update from old process.createChildProcess() to new child_proce…

…ss.spawn() API.
  • Loading branch information...
1 parent a52e02e commit 825fbb8cb08828748e841898912db1da648a7d1c @rentzsch committed May 1, 2010
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/supervisor.js
View
7 lib/supervisor.js
@@ -1,6 +1,7 @@
var sys = require("sys");
var fs = require("fs");
+var spawn = require("child_process").spawn;
exports.run = run;
@@ -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) });
}

0 comments on commit 825fbb8

Please sign in to comment.