[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: read -e does not restore terminal settings correctly when interrupte
From: |
Mickaël THOMAS |
Subject: |
Re: read -e does not restore terminal settings correctly when interrupted if a trap is set |
Date: |
Mon, 8 Sep 2014 21:05:47 +0200 |
Yep, that fixed the problem, thank you !
2014-09-08 20:46 GMT+02:00 Chet Ramey <address@hidden>:
> On 9/7/14, 6:40 PM, address@hidden wrote:
>
>> Bash Version: 4.3
>> Patch Level: 24
>> Release Status: release
>>
>> Description:
>> Given the following script (test.sh) :
>>
>> #!/bin/bash
>> cleanup() { :; }
>> trap cleanup 0
>> read -e dummy
>>
>> Run the script ('bash test.sh') *in ZSH* and when it waits for an
>> input,
>> interrupt it with Ctrl-C.
>
> Thanks for the report. The problem is that bash doesn't clean up readline
> and its terminal state in all cases that can result in its calling
> longjmp() or exiting the shell. I've attached a patch that should fix the
> problem.
>
> The problem doesn't manifest itself in bash because bash saves the terminal
> state before a command runs and restores it when the command is terminated
> by a signal.
>
> Chet
>
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
> ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, ITS, CWRU address@hidden http://cnswww.cns.cwru.edu/~chet/