[MERGE] Bugfix #87178: don't do sys.stdout.flush() outside exception wrapper
John Arbash Meinel
john at arbash-meinel.com
Thu Jun 21 16:11:41 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Alexander Belchenko wrote:
> This patch fixes problem described in bug report
> https://bugs.launchpad.net/bzr/+bug/87178.
>
> This patch simply revert changes made by Ian
> in revision 2394.2.6 (merged to 2448).
>
> [µ]
- ------------------------------------------------------------------------
=== modified file 'bzrlib/commands.py'
- --- bzrlib/commands.py 2007-06-06 11:06:04 +0000
+++ bzrlib/commands.py 2007-06-21 09:48:32 +0000
@@ -713,11 +713,9 @@
def run_bzr_catch_errors(argv):
try:
- - try:
- - return run_bzr(argv)
- - finally:
- - # do this here inside the exception wrappers to catch EPIPE
- - sys.stdout.flush()
+ return run_bzr(argv)
+ # do this here inside the exception wrappers to catch EPIPE
+ sys.stdout.flush()
except (KeyboardInterrupt, Exception), e:
# used to handle AssertionError and KeyboardInterrupt
# specially here, but hopefully they're handled ok by the
logger now
- -1.
You are doing 'sys.stdout.flush()" *after* 'return X', which means it
will never be run.
You could instead do:
retval = run_bzr(argv)
sys.stdout.flush()
return retval
We would want to make sure that still works, because Windows gives some
strange results when you try to 'sys.stdout.flush()' after the pipe is
broken. I thought we fixed the EPIPE handler to handle that exception.
Note, we could also be running into problems because the 'bzr' main
script does:
exit_val = bzrlib.commands.main(sys.argv)
sys.exit_func()
try:
sys.stdout.flush()
sys.stderr.flush()
except IOError, e:
import errno
if sys.platform != 'win32' or e.errno != errno.EINVAL:
raise
os._exit(exit_val)
But that looks like it is also trying to handle EINVAL at that level.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGepUtJdeBCYSNAAMRAsW0AJ9F5Yp/wstFYfT4de82MOGcQ8Wl0ACgsqNY
Uly2tsxoNYgj4iEQL2A/KAw=
=9lnm
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list