Subject: Re: bug#54681: timeout: Program called by timeout cannot interact with tty stdin when timeout is called by exec()

From: Pádraig Brady <[email-masked]>
Date: Sat, 2 Apr 2022 13:25:47 +0100

tag 54681 notabug
close 54681
stop

On 02/04/2022 11:22, Zhaofeng Yang wrote:
> Hi GNU Team,
> 
> I found that program called by timeout cannot interact with tty stdin
> when timeout is called by exec().
> 
> A simplest example is `timeout 10 timeout 5 cat`. cat cannot read input
> from tty stdin.
> 
> I also tried to run `timeout 5 cat` in other programs by exec(), and
> all of them cannot read tty stdin. For example,
> 
> import subprocess
> subprocess.run(f"timeout 5 cat", shell=True)

timeout has a --foreground option to support this case,
with the caveat that if the program forks children,
they'll not be timed out.

See https://www.gnu.org/software/coreutils/timeout for details.

cheers,
Pádraig