Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: send-break or EOF exit the shell in "vared"
Happened upon this while reviewing something else ...
On Sun, Feb 9, 2020 at 12:34 AM Stephane Chazelas <stephane@xxxxxxxxxxxx> wrote:
>
> zsh -c 'vared -c foo; echo $? $foo'
>
> If I press ^G (send-break widget), that exits the shell (with
> status 0), not just "vared".
>
> With:
>
> zsh -c '{ vared -c a; } always { TRY_BLOCK_ERROR=0; echo in always; }; echo $? $a'
>
> Upon ^G, the "always" block is run, but that still exits the
> shell (with status 2 this time) despite the TRY_BLOCK_ERROR=0
Looking at this a bit more closely, ^G is treated as an interrupt
here. This solves the issue:
zsh -c '{ vared -c a; } always {
TRY_BLOCK_INTERRUPT=0;
echo in always; }; echo $? $a'
However, an actual interrupt with ^C will still exit the whole shell,
in that specific example.
> zle-line-init() stty -icanon time 10 min 0 <&2
> zle -N zle-line-init
> {
> vared -c var
> } always {
> TRY_BLOCK_ERROR=0
> print in always
> }
> echo "$? $var"
This is an entirely different case. zle_main.c:getbyte() calls
zexit() directly if raw_getbyte() returns zero. This is probably a
bug, or it at least should be documented that when ZLE receives EOF it
behaves as if "exit" had been called. IGNORE_EOF will cause it to
retry 20 times, but it never stops getting EOF because the tty has in
fact closed the descriptor.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author