zsh-users
 help / color / mirror / code / Atom feed
* strange behavior
@ 2010-11-02 12:09 Vincent Lefevre
  2010-11-15 16:32 ` Vincent Lefevre
  0 siblings, 1 reply; 13+ messages in thread
From: Vincent Lefevre @ 2010-11-02 12:09 UTC (permalink / raw)
  To: zsh-users

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@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)


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2011-04-28 11:39 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-02 12:09 strange behavior Vincent Lefevre
2010-11-15 16:32 ` Vincent Lefevre
2010-11-15 17:24   ` Bart Schaefer
2010-11-16  3:10     ` Vincent Lefevre
2011-01-28 14:44       ` Vincent Lefevre
2011-01-28 15:49         ` Bart Schaefer
2011-01-30  0:37           ` Vincent Lefevre
2011-01-30 22:25             ` Bart Schaefer
2011-01-31  9:11               ` Vincent Lefevre
2011-04-11 14:26               ` Vincent Lefevre
2011-04-11 14:39                 ` Vincent Lefevre
2011-04-11 15:15                   ` Peter Stephenson
2011-04-28 11:32                     ` Vincent Lefevre

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).