bug-bash
[Top][All Lists]
Advanced

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

Re: Subject: Pressing Ctrl-C during any subshell evaluation terminates t


From: Chet Ramey
Subject: Re: Subject: Pressing Ctrl-C during any subshell evaluation terminates the shell
Date: Sun, 11 Oct 2020 15:59:27 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.12.1

On 10/9/20 7:23 PM, Daniel Farina wrote:

> Bash Version: 5.0
> Patch Level: 17
> Release Status: release
> 
> Description:
> 
> Pressing Ctrl-C during any subshell evaluation terminates the shell.  I
> noticed this when using direnv and emacs together: Ctrl-C would not cancel
> a subprocess started by the shell, but would exit the entire shell.
> 
> Relaying this from: https://github.com/direnv/direnv/issues/627
> 
> Repeat-By:
> 
> Per https://github.com/direnv/direnv/issues/627#issuecomment-635611930
> 
> $ cat bash.rc
> eval "$(direnv hook bash)"

What commands does this `direnv' command output?

> 
> $ bash --rcfile bash.rc
> bash$ echo $PROMPT_COMMAND
> _direnv_hook

What does `direnv_hook' do?

> bash$ $(sleep 10) # pressing ^C during those 10 seconds will terminate the
> shell
> ^C
> $ # inner shell terminated

My guess is that it messes with the controlling terminal somehow, causing
the shell to get EOF or -1/EIO when it attempts to read input.

Chet
-- 
``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]