[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: for loop goes to stopped job when Ctrl+C is pressed

From: Chet Ramey
Subject: Re: for loop goes to stopped job when Ctrl+C is pressed
Date: Tue, 20 Dec 2022 16:44:52 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.0

On 12/17/22 3:59 PM, ks1322 ks1322 wrote:
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -O2 -flto=auto -ffat-lto-objects -fexceptions -g
-grecord-gcc-switches -pipe -Wall -Werror=format-security
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-prote>
uname output: Linux yourdomain.com 6.0.12-300.fc37.x86_64 #1 SMP
PREEMPT_DYNAMIC Thu Dec 8 16:58:47 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu

Bash Version: 5.2
Patch Level: 9
Release Status: release

When for loop output is piped to less and Ctrl+C is pressed, bash creates
unexpected stopped job

Thanks, I'll take a look. `less' gets the SIGTTOU because it tries to set
the terminal attributes after the process group leader has already given
the terminal back to the original (parent shell) process group. The issue
is that it needs to wait until `less' has finished before doing that, or
not do it at all and let the parent shell do it after `less' has exited.


``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]