From 918c8081cac4d3cf6ac236b9d12c2d47dbdcf7c3 Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Tue, 6 Nov 2012 12:55:02 -0800 Subject: [PATCH] bunyan -p '*' --- CHANGES.md | 1 + bin/bunyan | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index daa0663..9d6b568 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,7 @@ ## bunyan 0.16.5 (not yet released) +- Allow `bunyan -p '*'` to capture bunyan dtrace probes from **all** processes. - issue #55: Add support for `BUNYAN_NO_COLOR` environment variable to turn off all output coloring. This is still overridden by the `--color` and `--no-color` options. diff --git a/bin/bunyan b/bin/bunyan index 12cb087..186c39f 100755 --- a/bin/bunyan +++ b/bin/bunyan @@ -403,7 +403,11 @@ function parseArgv(argv) { var pidArg = args.shift(); var pid = +(pidArg); if (isNaN(pid)) { - throw new Error(format('invalid pid: "%s"', pidArg)); + if (pidArg === '*') { + pid = '*' + } else { + throw new Error(format('invalid pid: "%s"', pidArg)); + } } parsed.pid = pid; break; @@ -912,7 +916,7 @@ function processStdin(opts, stylize, callback) { function processPid(opts, stylize, callback) { var leftover = ""; // Left-over partial line from last chunk. var argv = ['dtrace', '-Z', '-x', 'strsize=4k', '-qn', - format('bunyan%d:::log-*{printf("%s", copyinstr(arg0))}', opts.pid)]; + format('bunyan%s:::log-*{printf("%s", copyinstr(arg0))}', opts.pid)]; var dtrace = spawn(argv[0], argv.slice(1), // Share the stderr handle to have error output come // straight through. Only supported in v0.8+.