From 825fbb8cb08828748e841898912db1da648a7d1c Mon Sep 17 00:00:00 2001 From: rentzsch Date: Sat, 1 May 2010 12:07:36 -0500 Subject: [PATCH] [DEV] Update from old process.createChildProcess() to new child_process.spawn() API. --- lib/supervisor.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/supervisor.js b/lib/supervisor.js index 668d7e1..9bd0323 100644 --- a/lib/supervisor.js +++ b/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) }); }