Skip to content

Commit

Permalink
Merge pull request #275 from jamestalmage/pipe-forked-io-streams
Browse files Browse the repository at this point in the history
Pipe forked IO streams instead of forwarding `data` events.
  • Loading branch information
sindresorhus committed Nov 27, 2015
2 parents b370458 + 0ef0ca1 commit 306f28d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
5 changes: 1 addition & 4 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,7 @@ function run(file) {
.on('stats', stats)
.on('test', test)
.on('unhandledRejections', handleRejections)
.on('uncaughtException', handleExceptions)
.on('data', function (data) {
process.stdout.write(data);
});
.on('uncaughtException', handleExceptions);
}

function handleRejections(data) {
Expand Down
13 changes: 2 additions & 11 deletions lib/fork.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ module.exports = function (args) {
var file = args[0];

var options = {
silent: true,
cwd: path.dirname(file)
cwd: path.dirname(file),
stdio: ['ignore', process.stdout, process.stdout]
};

var ps = childProcess.fork(filepath, args, options);
Expand Down Expand Up @@ -76,15 +76,6 @@ module.exports = function (args) {
send(ps, 'teardown');
});

// emit data events on forked process' output
ps.stdout.on('data', function (data) {
ps.emit('data', data);
});

ps.stderr.on('data', function (data) {
ps.emit('data', data);
});

promise.on = function () {
ps.on.apply(ps, arguments);

Expand Down

0 comments on commit 306f28d

Please sign in to comment.