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

Re: prompt problem

On Sep 7,  9:26pm, Vincent Lefevre wrote:
} Any news?

My guess would be that this is a race condition of some kind.  In some
cases the TRAPCLD function gets called twice on a single interrupt.
It's somewhat easier to make this happen [and much easier to observe
that it is what happens] if (a) you put a "print" statement in the
precmd function and (b) you vary the number of seconds passed to each
sleep in the pipe.  When called twice, $? differs in each call -- it's
130 (INT) in the first call, and 0 in the second, in every case where
I got two calls to happen at all.

The race probably depends on which part of the pipeline gets signalled
first -- something over which zsh has no control, as it's counting on
the OS to kill the entire process group when managing of a pipeline.

As a further guess, when the process group is killed zsh wakes up and
starts to print the prompt when the SIGCHLD is received for the group
leader.  Another child in the group then exits, catching the internals
of ZLE in a state where the prompt has been printed but it hasn't
recorded that fact yet.

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