some cases to not page automatically

This commit is contained in:
Trent Mick 2013-01-22 17:27:30 -08:00
parent acfe28bffe
commit d1baeb197e
2 changed files with 15 additions and 9 deletions

View file

@ -8,7 +8,9 @@ Known issues:
## bunyan 0.18.1 (not yet released)
(nothing yet)
- Get the `bunyan` CLI to **not** automatically page (i.e. pipe to `less`)
if stdin isn't a TTY, or if following dtrace probe output (via `-p PID`),
or if not given log file arguments.
## bunyan 0.18.0

View file

@ -194,7 +194,7 @@ function printHelp() {
console.log("");
console.log("Output options:");
console.log(" --pager Pipe output into `less` (or $PAGER if set), if");
console.log(" stdout is a terminal. This overrides $BUNYAN_NO_PAGER.");
console.log(" stdout is a TTY. This overrides $BUNYAN_NO_PAGER.");
console.log(" Note: Paging is only supported on node >=0.8.");
console.log(" --no-pager Do not pipe output into a pager.");
console.log(" --color Colorize output. Defaults to try if output");
@ -1322,7 +1322,11 @@ function main(argv) {
// Pager.
var nodeVer = process.versions.node.split('.').map(Number);
var paginate = (process.stdout.isTTY
var paginate = (
process.stdout.isTTY
&& process.stdin.isTTY
&& !opts.pids // Don't page if following process output.
&& opts.args.length > 0 // Don't page if no file args to process.
&& process.platform !== 'win32'
&& nodeVer >= [0,8,0]
&& (opts.paginate === true