[merge] use os._exit

Martin Pool mbp at canonical.com
Tue Feb 20 05:11:39 GMT 2007


On 19 Feb 2007, Wouter van Heyst <larstiq at larstiq.dyndns.org> wrote:
> On Mon, Feb 19, 2007 at 03:38:43PM +1100, Martin Pool wrote:
> > On 19 Feb 2007, Alexander Belchenko <bialix at ukr.net> wrote:
> > > This patch already merged.
> > > But I want to say that it's bad. I'm -1 on this change.
> > > This patch cause to sudden break of tail in .bzr.log.
> > > Therefore long traceback for some error is not recorded properly.
> > 
> > I'm sorry you didn't get to look at it first.
> > 
> > This failure is clearly because we are not explicitly closing that file.
> > 
> > In my opinion we should explicitly close the file, and that will fix
> > this.  There is still some risk that other things won't be covered, and
> > I'll understand if people just want to back this out, but at the moment
> > I would rather fix them case by case.
> 
> Provided there isn't a huge amount of cases, sure.

Sure.

Here is the change that flushes the file:

=== modified file 'bzr'
--- bzr 2007-02-16 06:06:14 +0000
+++ bzr 2007-02-20 04:55:25 +0000
@@ -105,6 +105,9 @@
     # won't run but we don't use them.  Also file buffers won't be
     # flushed,
     # but our policy is to always close files from a finally block. --
     # mbp 20070215
     sys.stdout.flush()
+    if bzrlib.trace._trace_file:
+        # this is also _bzr_log
+        bzrlib.trace._trace_file.flush()
     # stderr isn't buffered
     os._exit(exit_val)
 else:



-- 
Martin



More information about the bazaar mailing list