changeset 1871:258e3a7955b8

patchbomb: ignore exception if pager quits.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Thu, 09 Mar 2006 16:26:49 -0800
parents 6a3d5a56f19c
children d8a03e9b3776
files hgext/patchbomb.py
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/patchbomb.py	Wed Mar 08 18:48:40 2006 -0800
+++ b/hgext/patchbomb.py	Thu Mar 09 16:26:49 2006 -0800
@@ -52,7 +52,7 @@
 from mercurial.demandload import *
 demandload(globals(), '''email.MIMEMultipart email.MIMEText email.Utils
                          mercurial:commands,hg,ui
-                         os popen2 smtplib socket sys tempfile time''')
+                         os errno popen2 smtplib socket sys tempfile time''')
 from mercurial.i18n import gettext as _
 
 try:
@@ -254,8 +254,12 @@
         if opts['test']:
             ui.status('Displaying ', m['Subject'], ' ...\n')
             fp = os.popen(os.getenv('PAGER', 'more'), 'w')
-            fp.write(m.as_string(0))
-            fp.write('\n')
+            try:
+                fp.write(m.as_string(0))
+                fp.write('\n')
+            except IOError, inst:
+                if inst.errno != errno.EPIPE:
+                    raise
             fp.close()
         elif opts['mbox']:
             ui.status('Writing ', m['Subject'], ' ...\n')