Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: prompt problem
- X-seq: zsh-workers 28242
- From: Vincent Lefevre <vincent@xxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: prompt problem
- Date: Tue, 7 Sep 2010 21:26:17 +0200
- In-reply-to: <20100820122823.GA4702@xxxxxxxxxxxxxxxxxxxx>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mail-followup-to: zsh-workers@xxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20100820122823.GA4702@xxxxxxxxxxxxxxxxxxxx>
Any news?
On 2010-08-20 14:28:23 +0200, Vincent Lefevre wrote:
> After a "zsh -f", source the following:
>
> precmd()
> {
> psvar[1]=$?
> if [[ $psvar[1] -gt 128 ]] then
> local sig=$signals[$(($psvar[1]-127))]
> [[ -n $sig ]] && psvar[1]=$sig
> fi
> }
>
> TRAPCLD() { [[ -o interactive && -n $TTY ]] && precmd }
>
> PS1="%m:%20<...<%~%<<%(?..[%1v])%(#.#.>) "
>
> then execute
>
> { sleep 3 } | { sleep 3 } | { sleep 3 } | { sleep 3 }
>
> and interrupt it with Ctrl-C.
>
> I can see two unexpected behaviors (not always reproducible, one
> needs to try several times), as seen here:
>
> ypig:~[INT]> { sleep 3 } | { sleep 3 } | { sleep 3 } | { sleep 3 }
> ^C%
> ypig:~[INT]> { sleep 3 } | { sleep 3 } | { sleep 3 } | { sleep 3 }
> ^C%
> ypig:~[INT]> { sleep 3 } | { sleep 3 } | { sleep 3 } | { sleep 3 }
> ^C%
> ypig:~[INT]> { sleep 3 } | { sleep 3 } | { sleep 3 } | { sleep 3 }
> ^C%
> ypig:~[INT]> ypig:~[INT]> { sleep 3 } | { sleep 3 } | { sleep 3 } | { sleep 3 }
> ^C%
> ypig:~[INT]> { sleep 3 } | { sleep 3 } | { sleep 3 } | { sleep 3 }
> ^C%
> ypig:~[0]> { sleep 3 } | { sleep 3 } | { sleep 3 } | { sleep 3 }
> ^C%
> ypig:~[0]> { sleep 3 } | { sleep 3 } | { sleep 3 } | { sleep 3 }
> ^C%
>
> So, sometimes the prompt is output twice. This seems to be a bug.
>
> I sometimes get a "[0]" instead of "[INT]". This one may be due
> to the fact that $? is 0 in the trap. I wonder whether this is
> correct. At least the behavior doesn't seem to be consistent
> with:
>
> ypig:~> sleep 5 &
> [1] 9217
> ypig:~> blah
> zsh: command not found: blah
> ypig:~[127]>
> ypig:~[127]>
> [1] + done sleep 5
> ypig:~[127]>
> ypig:~[127]> echo $?
> 127
>
> where the value of $? seems to be preserved after "sleep 5" has
> terminated.
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author