]> arthur.barton.de Git - bup.git/blobdiff - lib/cmd/bup
Enable --profile for built-in subcommands
[bup.git] / lib / cmd / bup
index 27276ad0a0b40f0df36b318467c1dd675fd4bfb1..ebe52a034bc015fb73c601926bb785e44aa2cbf1 100755 (executable)
@@ -257,7 +257,13 @@ def filter_output(src_out, src_err, dest_out, dest_err):
 def run_subcmd(module, args):
 
     if module:
-        return module.main(args)
+        if do_profile:
+            import cProfile
+            f = compile('module.main(args)', __file__, 'exec')
+            cProfile.runctx(f, globals(), locals())
+        else:
+            module.main(args)
+        return
 
     c = (do_profile and [sys.executable, b'-m', b'cProfile'] or []) + args
     if not (fix_stdout or fix_stderr):