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

Re: exit status problem



On Dec 6, 12:24pm, Vincent Lefevre wrote:
}
} > The status you're displaying is $? stored in psvar[1], correct?  And
} > that's set by precmd, and you're explicitly calling precmd
} > 
} > If I use %? instead, I get consistent behavior
} 
} What I don't understand is that if the problem is due to the precmd
} call from TRAPCLD, then why do I get
} 
} ypig:~[1]>                                                    <12:15:32
} [1]  + done       sleep 5
} ypig:~[1]>                                                    <12:15:35

It results from the timing of the trap handling.  The prompt is
reprinted because of the "[1]  + done" output before the CLD trap is
called; zsh does its internal signal handling before user traps.

Then on window resize the prompt is recomputed a second time, but this
time it's after your trap handler has run precmd.

} and why do I get "ypig:~[0]>" only after a window resize *and*
} typing [Enter].

If I poke something into RPS1 in a trap handler and then resize the
window, I see the change from the trap as soon as the window is
resized, not later after typing Enter.  But my xterm sends a stream
of SIGWINCH at the process underneath, it doesn't wait until I stop
resizing and then send the signal once.  Might that matter?

} If I do not resize the window, the prompt is not changed.

There is something confusing about the screen shots you first sent.
If those are in fact consecutive shots of the same terminal session,
as they appear to be, then it also appears that your prompt was

ypig:~[1]> 

at 15:59:59 *after* the screen resize, and then was *overwritten* at
16:00:03 by

ypig:~[0]> 

after which at 16:00:37 the prompt with [1] returns.  My question is,
what happened between 15:59:59 and 16:00:03 that caused the prompt to be
"updated in place"?  If all you did was hit Enter, the new prompt should
have appeared *below* the old one, not on top of it.



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