[Pkg-bazaar-commits] ./bzr/unstable r260: - remove atexit() dependency for writing out execution times
Martin Pool
mbp at sourcefrog.net
Fri Apr 10 07:51:34 UTC 2009
------------------------------------------------------------
revno: 260
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Fri 2005-04-15 12:41:52 +1000
message:
- remove atexit() dependency for writing out execution times
modified:
bzrlib/commands.py
bzrlib/trace.py
-------------- next part --------------
=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py 2005-04-15 02:29:03 +0000
+++ b/bzrlib/commands.py 2005-04-15 02:41:52 +0000
@@ -1019,24 +1019,27 @@
## than just a backtrace.
bzrlib.trace.create_tracefile(argv)
-
+
try:
- ret = run_bzr(argv)
- return ret
- except BzrError, e:
- log_error('bzr: error: ' + e.args[0])
- if len(e.args) > 1:
- for h in e.args[1]:
- log_error(' ' + h)
- traceback.print_exc(None, bzrlib.trace._tracefile)
- log_error('(see ~/.bzr.log for debug information)')
- return 1
- except Exception, e:
- log_error('bzr: exception: %s' % str(e).rstrip('\n'))
- log_error('(see $HOME/.bzr.log for debug information)')
- traceback.print_exc(None, bzrlib.trace._tracefile)
- ## traceback.print_exc(None, sys.stderr)
- return 1
+ try:
+ ret = run_bzr(argv)
+ return ret
+ except BzrError, e:
+ log_error('bzr: error: ' + e.args[0])
+ if len(e.args) > 1:
+ for h in e.args[1]:
+ log_error(' ' + h)
+ traceback.print_exc(None, bzrlib.trace._tracefile)
+ log_error('(see ~/.bzr.log for debug information)')
+ return 1
+ except Exception, e:
+ log_error('bzr: exception: %s' % str(e).rstrip('\n'))
+ log_error('(see $HOME/.bzr.log for debug information)')
+ traceback.print_exc(None, bzrlib.trace._tracefile)
+ ## traceback.print_exc(None, sys.stderr)
+ return 1
+ finally:
+ bzrlib.trace.close_trace()
## TODO: Trap AssertionError
=== modified file 'bzrlib/trace.py'
--- a/bzrlib/trace.py 2005-04-15 02:29:03 +0000
+++ b/bzrlib/trace.py 2005-04-15 02:41:52 +0000
@@ -115,11 +115,8 @@
_write_trace(' arguments: %r' % argv)
_write_trace(' working dir: ' + os.getcwdu())
- import atexit
- atexit.register(_close_trace)
-
-
-def _close_trace():
+
+def close_trace():
times = os.times()
mutter("finished, %.3fu/%.3fs cpu, %.3fu/%.3fs cum, %.3f elapsed"
% (times[:4] + ((times[4] - _starttime),)))
More information about the Pkg-bazaar-commits
mailing list