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

Re: precmd: write error: interrupted

(Redirecting this to -workers, so Yuri Cc'd in case he's only on -users)

On Apr 25,  9:38pm, Yuri D'Elia wrote:
} precmd() { { print x } 2>/dev/null }
} still doesn't suppress the error.

Interesting!  Something is restoring the stderr descriptors before the
error message in bin_print is written.  Here is a bit of strace from
'zsh -f' with { print -n $'x\r' } 2>/devnull running in a loop on the
command line (not from a precmd):

open("/dev/null", O_WRONLY|O_CREAT|O_NOCTTY|O_TRUNC|O_LARGEFILE, 0666) = 3
dup2(3, 2)                              = 2
write(1, "x\r", 2)                      = ? ERESTARTSYS (To be restarted)
--- SIGWINCH (Window changed) @ 0 (0) ---
dup2(12, 2)                             = 2
dup2(11, 2)                             = 2
write(10, "\33[1m\33[7m%\33[27m\33[1m\33[0m                                     
                                           \r \r", 105) = 105
write(2, "print: write error: interrupt\n", 30) = 30

Those dup2 calls should happen only at the end of execcmd after bin_print
has already returned, but somehow they appear to be happening after the
signal handler is called but before the error message.

Attaching with a debugger blocks the interrupt so I haven't been able to
stack-trace the source of the dup2 calls.

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