ensure dtrace stderr is piped through

This commit is contained in:
Trent Mick 2012-11-02 13:27:58 -07:00
parent d133deff82
commit 44fc428a8a
2 changed files with 7 additions and 2 deletions

View file

@ -2,7 +2,9 @@
## bunyan 0.16.2 (not yet released) ## bunyan 0.16.2 (not yet released)
(nothing yet) - Ensure that stderr from the dtrace child process (when using `bunyan -p PID`)
gets through. The `pipe` usage wasn't working on SmartOS. This is important
to show the user if they need to 'sudo'.
## bunyan 0.16.1 ## bunyan 0.16.1

View file

@ -910,7 +910,10 @@ function processPid(opts, stylize, callback) {
var dtrace = spawn(argv[0], argv.slice(1)); var dtrace = spawn(argv[0], argv.slice(1));
child = dtrace; // intentionall global child = dtrace; // intentionall global
dtrace.stderr.pipe(process.stderr); dtrace.stderr.setEncoding('utf8');
dtrace.stderr.on('data', function (chunk) {
process.stderr.write(chunk);
});
dtrace.stdout.setEncoding('utf8'); dtrace.stdout.setEncoding('utf8');
dtrace.stdout.on('data', function (chunk) { dtrace.stdout.on('data', function (chunk) {