Subject: bug#21760: timeout: Feature Request: --verbose ==> output if timeout was reached

From: Pádraig Brady <[email-masked]>
Date: Mon, 26 Oct 2015 11:44:10 +0000

tag 21760 wontfix
close 21760
stop

On 26/10/15 10:30, Thomas Güttler wrote:
> About commandline tool "timeout": Start COMMAND, and kill it if still running after DURATION.
> 
> A new team mate wasted some time to debug why
> a process was killed with signal 15.
> 
> I think it would be nice to have an --verbose option, and a some
> text which explains why the signal was send.
> 
> This is important in environments where the one who reads
> the script failures is not the same person who writes the script.
> 
> What do you think?
> 
> Example:
> 
> Old:
> 
>    user@host:~$ timeout 1s ping localhost
>    PING localhost (127.0.0.1) 56(84) bytes of data.
>    64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.078 ms
> 
> New:
> 
>    user@host:~$ timeout 1s ping localhost
>    PING localhost (127.0.0.1) 56(84) bytes of data.
>    64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.078 ms
>    ** Process "ping localhost" was killed with signal 16 since the timeout of 1s was reached. **

I've not sure there is enough distinct actions within timeout(1) to warrant --verbose?
How about doing this in the script?

  timeout 1s ping localhost
  test $? = 124 && echo { 'ping timed out'; exit 1; }

thanks,
Pádraig.