diff -r 4417eb761ba8 -r 329887a7074c mercurial/ui.py --- a/mercurial/ui.py Fri Apr 06 15:16:30 2012 -0500 +++ b/mercurial/ui.py Fri Apr 06 15:18:14 2012 -0500 @@ -483,7 +483,7 @@ if not getattr(self.ferr, 'closed', False): self.ferr.flush() except IOError, inst: - if inst.errno not in (errno.EPIPE, errno.EIO): + if inst.errno not in (errno.EPIPE, errno.EIO, errno.EBADF): raise def flush(self):