Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [BUG] zsh dies in case of EIO with echo in .zlogout / ENOTTY



On 7/12/21, Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
> In my .zlogout, I have an "echo" command. However, if the terminal
> is no longer there, the "echo" yields EIO errors and the remaining
> of the .zlogout is not executed, e.g. with "echo foo" in .zlogout
> and
>
>   xterm -e strace -f -o str.out zsh -l

If you're looking for a workaround in the meantime, I think this will
work (didn't test in .zlogout)

{ } always {
your actual code here
}

eg with Peter's example,
 exec 2>&-
 { } always {
 echo e2 >&2
 echo hi
 }
. ./source.zsh prints hi

-- 
Mikael Magnusson




Messages sorted by: Reverse Date, Date, Thread, Author