Ignore EPIPE in pipefilter
This hides the following traceback (there's a race condition involved,
so you may have to try a few times to hit it):
$ hg sign --key key-that-does-not-exist
Signing 2062:4bad92f4ea65
gpg: skipped "key-that-does-not-exist": secret key not available
gpg: signing failed: secret key not available
Exception in thread Thread-1:
Traceback (most recent call last):
File "threading.py", line 442, in __bootstrap
self.run()
File "threading.py", line 422, in run
self.__target(*self.__args, **self.__kwargs)
File "mercurial/util.py", line 24, in writer
pin.close()
IOError: [Errno 32] Broken pipe
abort: Error while signing
--- a/mercurial/util.py Wed Apr 19 11:41:22 2006 -0700
+++ b/mercurial/util.py Wed Apr 19 11:41:25 2006 -0700
@@ -20,8 +20,12 @@
'''filter string S through command CMD, returning its output'''
(pout, pin) = popen2.popen2(cmd, -1, 'b')
def writer():
- pin.write(s)
- pin.close()
+ try:
+ pin.write(s)
+ pin.close()
+ except IOError, inst:
+ if inst.errno != errno.EPIPE:
+ raise
# we should use select instead on UNIX, but this will work on most
# systems, including Windows