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 isn't working as expected if both stdout and stderr are redirected #65

Open dmeremyanin opened 10 months ago

dmeremyanin commented 10 months ago

Describe the problem

Timeout isn't working as expected if both stdout and stderr are redirected.

Steps to reproduce the problem

TTY::Command.new(printer: :quiet).run!('sleep 5', timeout: 1, [:out, :err] => '/dev/null')

Actual behaviour

The code above doesn't fail. It takes 5 seconds to run and ignores the timeout option set to 1 second.

Expected behaviour

The code above should raise an exception.

Describe your environment