{"thread":{"id":"880","subject":"[PATCH 4/6] Only invoke pager if there's any output","startedAt":"2005-06-09T11:21:26Z","lastAt":"2005-06-09T11:21:26Z","messageCount":1,"participants":["Dan Holmsand"],"isPatch":true,"patchVersion":1,"patchTotal":6},"messages":[{"id":"4779","messageId":"42A82636.1060505@gmail.com","threadId":"880","inReplyTo":null,"subject":"[PATCH 4/6] Only invoke pager if there's any output","fromName":"Dan Holmsand","fromEmail":"holmsand@gmail.com","sentAt":"2005-06-09T11:21:26Z","receivedAt":"2005-06-09T11:21:26Z","isPatch":true,"sender":{"key":"holmsand@gmail.com","avatar":"https://gravatar.com/avatar/5c722084bafd85e754a02efad01fe69107eb6f393253c49232c5c9f7faa974df?d=mp&s=160"},"body":"This avoids annoying empty \"less\" window if there's no output\nfrom cg-diff, for example.\n\nSigned-off-by: Dan Holmsand <holmsand@gmail.com>\n---\n\n\n\n cg-Xlib |    6 +++++-\n 1 files changed, 5 insertions(+), 1 deletions(-)\n\ndiff --git a/cg-Xlib b/cg-Xlib\n--- a/cg-Xlib\n+++ b/cg-Xlib\n@@ -22,7 +22,11 @@ usage() {\n }\n \n pager () {\n-\tLESS=\"R$LESS\" ${PAGER:-less} $PAGER_FLAGS\n+\t# Invoke $PAGER if there is any output\n+\tlocal line\n+\tif read -r line; then\n+\t\t( echo \"$line\"; cat ) | LESS=\"-R $LESS\" ${PAGER:-less}\n+\tfi\n }\n \n mktemp () {\n"}]}