diff --git a/bin/cmd.js b/bin/cmd.js index 619594e..f07757b 100755 --- a/bin/cmd.js +++ b/bin/cmd.js @@ -12,14 +12,13 @@ var argv = minimist(process.argv.slice(2), { if (!process.stdin.isTTY || argv._[0] === '-' || argv.stdin) { var snazzy = new CompactToStylishStream() - // Set the process exit code based on whether snazzy found errors. + // Set the process exit code based on whether snazzy found errors process.on('exit', function (code) { if (code === 0 && snazzy.exitCode !== 0) { - process.exit(snazzy.exitCode) + process.exitCode = snazzy.exitCode } }) - process.stdout.on('error', function () {}) process.stdin.pipe(snazzy).pipe(process.stdout) } else { console.error(` diff --git a/index.js b/index.js index 1c52c15..2f39ee6 100644 --- a/index.js +++ b/index.js @@ -14,6 +14,7 @@ function CompactToStylishStream (opts) { } stream.Transform.call(this, opts) + this.exitCode = 0 this._buffer = [] }