|
@@ -4,7 +4,7 @@
|
|
|
# file, as all names will be seen by the exec'ed file. To prevent name collisions, all names
|
|
|
# defined here should begin with 'traceback_run_'
|
|
|
|
|
|
-import sys
|
|
|
+import sys,time
|
|
|
|
|
|
def traceback_run_init():
|
|
|
import os
|
|
@@ -29,13 +29,14 @@ def traceback_run_process_exception():
|
|
|
exc = l.pop()
|
|
|
if exc[:11] == 'SystemExit:': l.pop()
|
|
|
|
|
|
- def red(s): return '{e}[31;1m{}{e}[0m'.format(s,e='\033')
|
|
|
- def yellow(s): return '{e}[33;1m{}{e}[0m'.format(s,e='\033')
|
|
|
+ red = lambda s: '\033[31;1m{}\033[0m'.format(s)
|
|
|
+ yellow = lambda s: '\033[33;1m{}\033[0m'.format(s)
|
|
|
sys.stdout.write('{}{}'.format(yellow(''.join(l)),red(exc)))
|
|
|
|
|
|
open(traceback_run_outfile,'w').write(''.join(l+[exc]))
|
|
|
|
|
|
traceback_run_outfile = traceback_run_init()
|
|
|
+traceback_run_tstart = time.time()
|
|
|
|
|
|
try:
|
|
|
sys.argv.pop(0)
|
|
@@ -48,6 +49,10 @@ except SystemExit as e:
|
|
|
except Exception as e:
|
|
|
traceback_run_process_exception()
|
|
|
sys.exit(e.mmcode if hasattr(e,'mmcode') else e.code if hasattr(e,'code') else 1)
|
|
|
+
|
|
|
+blue = lambda s: '\033[34;1m{}\033[0m'.format(s)
|
|
|
+sys.stdout.write(blue('Runtime: {:0.5f} secs\n'.format(time.time() - traceback_run_tstart)))
|
|
|
+
|
|
|
# else:
|
|
|
# print('else: '+repr(sys.exc_info()))
|
|
|
# finally:
|