Closed lmarburger closed 8 years ago
Might as well just rescue Errno::EPIPE
along with Interrupt
👍🏻
LGTM
$ papertrail --version
papertrail version 0.9.15
$ papertrail | head -n 1
May 16 15:04:47 ...
/Users/larry/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/papertrail-0.9.15/lib/papertrail/cli.rb:182:in `write': Broken pipe @ io_write - <STDOUT> (Errno::EPIPE)
from /Users/larry/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/papertrail-0.9.15/lib/papertrail/cli.rb:182:in `puts'
from /Users/larry/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/papertrail-0.9.15/lib/papertrail/cli.rb:182:in `display_result'
from /Users/larry/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/papertrail-0.9.15/lib/papertrail/cli.rb:190:in `block in display_results'
from /Users/larry/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/papertrail-0.9.15/lib/papertrail/cli.rb:189:in `each'
from /Users/larry/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/papertrail-0.9.15/lib/papertrail/cli.rb:189:in `display_results'
from /Users/larry/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/papertrail-0.9.15/lib/papertrail/cli.rb:137:in `run'
from /Users/larry/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/papertrail-0.9.15/bin/papertrail:5:in `<top (required)>'
from /Users/larry/.rbenv/versions/2.2.3/bin/papertrail:23:in `load'
from /Users/larry/.rbenv/versions/2.2.3/bin/papertrail:23:in `<main>'
$ gem install papertrail
Fetching: papertrail-0.9.16.gem (100%)
Successfully installed papertrail-0.9.16
1 gem installed
$ papertrail --version
papertrail version 0.9.16
$ papertrail | head -n 1
May 16 15:05:43 ...
When piping
papertrail
to another program, the downstream program can close the pipe and we need to exit cleanly. It seems this can be resolved either by trappingPIPE
or rescuingErrno::EPIPE
(likely inPapertrail::Cli#run
). Opted for the former but I have no preference.closes #73