piotrmurach / tty-command

Execute shell commands with pretty output logging and capture stdout, stderr and exit status.
https://ttytoolkit.org
MIT License
400 stars 34 forks source link

Timeout also displays traceback #48

Closed hatlord closed 5 years ago

hatlord commented 5 years ago

Hi,

I noticed that in more recent versions of TTY-Command (0.8.0+), a timeout will output a traceback to the terminal. I have already rescued and display an error message of my own, what is the best way of suppressing the traceback? Example included below.

#<Thread:0x00007ffca2a31820@/usr/local/lib/ruby/gems/2.5.0/gems/tty-command-0.8.1/lib/tty/command/process_runner.rb:159 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
/usr/local/lib/ruby/gems/2.5.0/gems/tty-command-0.8.1/lib/tty/command/process_runner.rb:165:in `block in read_stream': TTY::Command::TimeoutExceeded (TTY::Command::TimeoutExceeded)

Thanks,

piotrmurach commented 5 years ago

Hi,

This traceback is unrelated to the tty-command version but Ruby version. I've checked that this starts to be the case from Ruby 2.5.0. Charles Nutter has submitted an issue to change Ruby behaviour to report errors in console when Thread terminates unexpectedly. In the past you needed to specify this behaviour explicility. I can see why this is a good thing since it provides a better transparency and prevents errors being swallowed by dying thread. However, I'm not sure what is the best solution in this case.

piotrmurach commented 5 years ago

Released v0.8.2 with the fix.

hatlord commented 5 years ago

Worked perfectly for me, many thanks!