Since http://subversion.tigris.org/issues/show_bug.cgi?id=3014
("svn log | head" should not print "Write error: Broken pipe")
isn't fixed yet, I've eventually written a simple wrapper. See
attachment. It's not perfect, but better than nothing.

Note: for those who use localized messages, the script needs to
be modified accordingly.

-- 
Vincent Lefèvre <vinc...@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)
#!/bin/sh

# svn wrapper to avoid "svn: Write error: Broken pipe" error messages
# when piping the svn output to some command.
#
# Caveat: if svn fails, its exit status is lost. However this script
# will generally be used in an interactive way before a pipe (where
# the user doesn't have a direct access to the exit status), and the
# user can still look at the possible other error messages.
#
# Script written by Vincent Lefevre <vinc...@vinc17.net> in July 2010,
# released in the public domain.

filter()
{
  unset brpipe
  while read err
  do
    case "$err" in
      *Write\ error:\ Broken\ pipe) brpipe=1 ;;
      *) printf "%s\n" "$err" ;;
    esac
  done
  test -z "$brpipe" || kill -PIPE $$
}

{ svn "$@" 2>&1 >&3 3>&- | filter >&2 3>&-; } 3>&1

# $Id: svnwrapper 38281 2010-07-30 13:34:46Z vinc17/ypig $

Reply via email to