]> arthur.barton.de Git - bup.git/commitdiff
main.py: use execvp() instead of subprocess.Popen() when possible.
authorAvery Pennarun <apenwarr@gmail.com>
Sun, 13 Feb 2011 09:52:51 +0000 (01:52 -0800)
committerAvery Pennarun <apenwarr@gmail.com>
Sun, 13 Feb 2011 13:02:21 +0000 (05:02 -0800)
This avoids an extra process showing up in the 'ps' listing if we're not
going to be using bup-newliner anyhow.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
main.py

diff --git a/main.py b/main.py
index 3d56ed49f44018adebf326d7e5432f55b9a903f4..e491ce1ad89efb5b7ac50ee08746bc730208968a 100755 (executable)
--- a/main.py
+++ b/main.py
@@ -169,7 +169,12 @@ p = None
 try:
     try:
         c = (do_profile and [sys.executable, '-m', 'cProfile'] or []) + subcmd
-        p = subprocess.Popen(c, stdout=outf, stderr=errf, preexec_fn=force_tty)
+        if not n and not outf and not errf:
+            # shortcut when no bup-newliner stuff is needed
+            os.execvp(c[0], c)
+        else:
+            p = subprocess.Popen(c, stdout=outf, stderr=errf,
+                                 preexec_fn=force_tty)
         while 1:
             # if we get a signal while waiting, we have to keep waiting, just
             # in case our child doesn't die.