GNU bug report logs - #54681
timeout: Program called by timeout cannot interact with tty stdin when timeout is called by exec()

Previous Next

Package: coreutils;

Reported by: Zhaofeng Yang <yangzhaofeng <at> arcas-da.com>

Date: Sat, 2 Apr 2022 11:24:01 UTC

Severity: normal

Tags: notabug

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Zhaofeng Yang <yangzhaofeng <at> arcas-da.com>
Cc: 54681 <at> debbugs.gnu.org
Subject: bug#54681: timeout: Program called by timeout cannot interact with tty stdin when timeout is called by exec()
Date: Sat, 02 Apr 2022 14:21:14 +0200
On Apr 02 2022, Zhaofeng Yang wrote:

> A simplest example is `timeout 10 timeout 5 cat`. cat cannot read input
> from tty stdin.

That's because timeout creates a new process group by default.  The
outer timeout instance already runs in its own process group curtesy of
the parent shell (and thus remains in that group), but for the inner
instance the process group no longer matches the terminal process group,
and thus the children cannot read from the TTY.  You can use timeout
--foreground to avoid that.

$ timeout 10 timeout --foreground 5 cat

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




This bug report was last modified 3 years and 109 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.