Permalink
Browse files

Added streaming output.

  • Loading branch information...
1 parent fe3313f commit a3841f2763eb1eea13145dade758a0defc6ae0da @beefsack committed May 20, 2012
Showing with 9 additions and 5 deletions.
  1. +9 −5 lib/exec.js
View
@@ -18,10 +18,14 @@ function exec (args, cb) {
cmd = "SET OLDPATH=%PATH% & SET PATH=" + b + ";%PATH% & " +
args.join(" ") + " & SET PATH=%OLDPATH%"
else
- cmd = "PATH=" + b + ":$PATH " + args.join(" ")
- cp.exec(cmd, function (error, stdout, stderr) {
- if (error !== null) return cb(stderr.replace(/\n$/, ''))
- var o = stdout.replace(/\n$/, '')
- output.write(o, function (er) { cb(er, o) })
+ cmd = "PATH=" + b + ":$PATH " + args.join(" ")
+ p = cp.exec(cmd, function(error, stdout, stderr) {
+ cb()
+ })
+ p.stdout.on('data', function(data) {
+ console.log(data.toString().replace(/\n$/, ''))
+ })
+ p.stderr.on('data', function(data) {
+ console.error(data.toString().replace(/\n$/, ''))
})
}

0 comments on commit a3841f2

Please sign in to comment.