From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17196 invoked by alias); 2 Nov 2010 12:09:54 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 15522 Received: (qmail 11441 invoked from network); 2 Nov 2010 12:09:50 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at vinc17.net does not designate permitted sender hosts) Date: Tue, 2 Nov 2010 13:09:43 +0100 From: Vincent Lefevre To: zsh-users@zsh.org Subject: strange behavior Message-ID: <20101102120943.GK19295@prunille.vinc17.org> Mail-Followup-To: zsh-users@zsh.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Mailer-Info: http://www.vinc17.net/mutt/ User-Agent: Mutt/1.5.21-6164-vl-r38670 (2010-10-13) 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 - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)