From: Vincent Lefevre <vincent@vinc17.net>
To: zsh-workers@zsh.org
Subject: Re: prompt problem
Date: Tue, 7 Sep 2010 21:26:17 +0200 [thread overview]
Message-ID: <20100907192617.GA22081@prunille.vinc17.org> (raw)
In-Reply-To: <20100820122823.GA4702@ypig.lip.ens-lyon.fr>
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@vinc17.net> - 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)
next prev parent reply other threads:[~2010-09-07 19:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-20 12:28 Vincent Lefevre
2010-09-07 19:26 ` Vincent Lefevre [this message]
2010-09-08 8:19 ` Bart Schaefer
-- strict thread matches above, loose matches on Subject: below --
1996-12-17 12:51 Prompt problem Alexey Solovyov
1996-12-17 13:10 ` Goran Larsson
1996-12-17 13:24 ` gwing
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100907192617.GA22081@prunille.vinc17.org \
--to=vincent@vinc17.net \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).