Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 2096:f5ebe964c6be
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
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Wed, 19 Apr 2006 11:41:25 -0700 |
parents | eb40db373717 |
children | fd77b7ee4aac |
comparison
equal
deleted
inserted
replaced
2095:0bf2a9e5eff1 | 2096:f5ebe964c6be |
---|---|
18 | 18 |
19 def pipefilter(s, cmd): | 19 def pipefilter(s, cmd): |
20 '''filter string S through command CMD, returning its output''' | 20 '''filter string S through command CMD, returning its output''' |
21 (pout, pin) = popen2.popen2(cmd, -1, 'b') | 21 (pout, pin) = popen2.popen2(cmd, -1, 'b') |
22 def writer(): | 22 def writer(): |
23 pin.write(s) | 23 try: |
24 pin.close() | 24 pin.write(s) |
25 pin.close() | |
26 except IOError, inst: | |
27 if inst.errno != errno.EPIPE: | |
28 raise | |
25 | 29 |
26 # we should use select instead on UNIX, but this will work on most | 30 # we should use select instead on UNIX, but this will work on most |
27 # systems, including Windows | 31 # systems, including Windows |
28 w = threading.Thread(target=writer) | 32 w = threading.Thread(target=writer) |
29 w.start() | 33 w.start() |