Browse files

pipe the npm output to stdout

  • Loading branch information...
1 parent 37b7f38 commit f82f7f8af3c6ce74fe3a8e6777d0b14587bb7098 @substack committed Apr 3, 2013
Showing with 5 additions and 8 deletions.
  1. +5 −8 lib/spawn.js
View
13 lib/spawn.js
@@ -26,9 +26,8 @@ module.exports = function (commit, env, cb) {
var cmd = before.shift();
if (!Array.isArray(cmd)) cmd = parseQuote(cmd);
var ps = commit.spawn(cmd, { env: env });
- var output = '';
- ps.stdout.on('data', function (buf) { output += buf });
- ps.stderr.on('data', function (buf) { output += buf });
+ ps.stdout.pipe(process.stdout, { end: false });
+ ps.stderr.pipe(process.stderr, { end: false });
var to = setTimeout(function () {
ps.removeListener('exit', onexit);
@@ -39,11 +38,9 @@ module.exports = function (commit, env, cb) {
function onexit (code) {
clearTimeout(to);
if (code !== 0) {
- cb([
- 'non-zero exit code ', code,
- ' from command: ', cmd.join(' '), '\n',
- output
- ].join(''));
+ cb('non-zero exit code ' + code
+ + ' from command: ' + cmd.join(' ')
+ );
}
else next()
}

0 comments on commit f82f7f8

Please sign in to comment.