diff hgext/patchbomb.py @ 49304:48f1b314056b

py3: catch BrokenPipeError instead of checking errno == EPIPE
author Manuel Jacob <me@manueljacob.de>
date Tue, 31 May 2022 16:54:58 +0200
parents 6000f5b25c9b
children a6b497872b97
line wrap: on
line diff
--- a/hgext/patchbomb.py	Tue May 31 04:18:22 2022 +0200
+++ b/hgext/patchbomb.py	Tue May 31 16:54:58 2022 +0200
@@ -76,7 +76,6 @@
 import email.mime.base as emimebase
 import email.mime.multipart as emimemultipart
 import email.utils as eutil
-import errno
 import os
 import socket
 
@@ -984,9 +983,8 @@
             try:
                 generator.flatten(m, False)
                 ui.write(b'\n')
-            except IOError as inst:
-                if inst.errno != errno.EPIPE:
-                    raise
+            except BrokenPipeError:
+                pass
         else:
             if not sendmail:
                 sendmail = mail.connect(ui, mbox=mbox)