From 44fc428a8aa882be4e28cad11672a1169a292ae9 Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Fri, 2 Nov 2012 13:27:58 -0700 Subject: [PATCH] ensure dtrace stderr is piped through --- CHANGES.md | 4 +++- bin/bunyan | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index b246dcc..09b6cf0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,7 +2,9 @@ ## 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 diff --git a/bin/bunyan b/bin/bunyan index 6876f32..b8a0e4f 100755 --- a/bin/bunyan +++ b/bin/bunyan @@ -910,7 +910,10 @@ function processPid(opts, stylize, callback) { var dtrace = spawn(argv[0], argv.slice(1)); 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.on('data', function (chunk) {