#111 Fix a crash when attempting to use bunyan -p
on a platform without dtrace.
Also fix exit status if the spawned dtrace exits non-zero.
This commit is contained in:
parent
f4f8f3e148
commit
6208e87eca
2 changed files with 14 additions and 1 deletions
|
@ -8,6 +8,9 @@ Known issues:
|
||||||
|
|
||||||
## bunyan 0.22.1 (not yet released)
|
## bunyan 0.22.1 (not yet released)
|
||||||
|
|
||||||
|
- #111 Fix a crash when attempting to use `bunyan -p` on a platform without
|
||||||
|
dtrace.
|
||||||
|
|
||||||
- #101 Fix a crash in `bunyan` rendering a record with unexpected "res.headers".
|
- #101 Fix a crash in `bunyan` rendering a record with unexpected "res.headers".
|
||||||
|
|
||||||
|
|
||||||
|
|
12
bin/bunyan
12
bin/bunyan
|
@ -1129,6 +1129,15 @@ function processPids(opts, stylize, callback) {
|
||||||
// Share the stderr handle to have error output come
|
// Share the stderr handle to have error output come
|
||||||
// straight through. Only supported in v0.8+.
|
// straight through. Only supported in v0.8+.
|
||||||
{stdio: ['pipe', 'pipe', process.stderr]});
|
{stdio: ['pipe', 'pipe', process.stderr]});
|
||||||
|
dtrace.on('error', function (e) {
|
||||||
|
if (e.syscall === 'spawn' && e.errno === 'ENOENT') {
|
||||||
|
console.error('bunyan: error: could not spawn "dtrace" ' +
|
||||||
|
'("bunyan -p" is only supported on platforms with dtrace)');
|
||||||
|
} else {
|
||||||
|
console.error('bunyan: error: unexpected dtrace error: %s', e);
|
||||||
|
}
|
||||||
|
callback(1);
|
||||||
|
})
|
||||||
child = dtrace; // intentionally global
|
child = dtrace; // intentionally global
|
||||||
|
|
||||||
function finish(code) {
|
function finish(code) {
|
||||||
|
@ -1136,7 +1145,7 @@ function processPids(opts, stylize, callback) {
|
||||||
handleLogLine(null, leftover, opts, stylize);
|
handleLogLine(null, leftover, opts, stylize);
|
||||||
leftover = '';
|
leftover = '';
|
||||||
}
|
}
|
||||||
callback(returnCode);
|
callback(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
dtrace.stdout.setEncoding('utf8');
|
dtrace.stdout.setEncoding('utf8');
|
||||||
|
@ -1350,6 +1359,7 @@ process.on('uncaughtException', function (err) {
|
||||||
e('* https://github.com/trentm/node-bunyan/issues/new?title=%s', title);
|
e('* https://github.com/trentm/node-bunyan/issues/new?title=%s', title);
|
||||||
e('*');
|
e('*');
|
||||||
e('* * *');
|
e('* * *');
|
||||||
|
e('* platform:', process.platform);
|
||||||
e('* node version:', process.version);
|
e('* node version:', process.version);
|
||||||
e('* bunyan version:', getVersion());
|
e('* bunyan version:', getVersion());
|
||||||
e('* argv: %j', process.argv);
|
e('* argv: %j', process.argv);
|
||||||
|
|
Loading…
Reference in a new issue