Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
strange behavior
- X-seq: zsh-users 15522
- From: Vincent Lefevre <vincent@xxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: strange behavior
- Date: Tue, 2 Nov 2010 13:09:43 +0100
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mail-followup-to: zsh-users@xxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
With the svnwrapper script below, I got after rebooting the machine:
ypig:~/wd> up
At revision 40202.
zsh: exit 141
ypig:~/wd[PIPE]>
where "up" does "svnwrapper up". I don't see how this could be
possible, as the only svn output is "At revision 40202." to stdout
(nothing to stderr here, so that brpipe remains unset).
svnwrapper script:
#!/usr/bin/env zsh
filter()
{
unset brpipe
while true
do
unset line timeout
while read -r $timeout -k -u 0 ch
do
line="$line$ch"
[[ $ch = $'\012' ]] && break
timeout=(-t 0.1)
done
case $line in
svnwrapper:term$'\012')
break ;;
*Broken\ pipe$'\012') brpipe=1 ;;
?*) printf "%s" "$line" >&2 ;;
*) break ;; # empty line (end of file) - parent has died?
esac
done
# The "sleep 5" is there to avoid a rare race condition (it occurred
# once): make sure the parent process receives the PIPE signal before
# the filter process terminates (which can yield a SIGPIPE in svn).
[[ -z $brpipe ]] || { kill -PIPE $$; sleep 5 }
}
{ svn "$@"; st=$?; echo "svnwrapper:term" >&2 } 2>>(filter)
exit $st
--
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