]> arthur.barton.de Git - bup.git/commitdiff
import-duplicity: use readpipe, not check_output
authorRob Browning <rlb@defaultvalue.org>
Sat, 9 Jul 2016 01:13:46 +0000 (20:13 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sat, 9 Jul 2016 19:52:55 +0000 (14:52 -0500)
Python 2.6 doesn't have check_output.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
cmd/import-duplicity-cmd.py
lib/bup/helpers.py

index ff37daf0e99bfd5ab859b601399d450d12f18fb8..0d4f5593ac2aa635451579dfad17b8c5ec07cdf0 100755 (executable)
@@ -7,13 +7,13 @@ exec "$bup_python" "$0" ${1+"$@"}
 
 from calendar import timegm
 from pipes import quote
-from subprocess import check_call, check_output
+from subprocess import check_call
 from time import strftime, strptime
 import sys
 import tempfile
 
 from bup import git, options, vfs
-from bup.helpers import handle_ctrl_c, log, saved_errors, unlink
+from bup.helpers import handle_ctrl_c, log, readpipe, saved_errors, unlink
 import bup.path
 
 optspec = """
@@ -40,7 +40,7 @@ def exo(cmd, shell=False):
     global opt
     logcmd(cmd)
     if not opt.dry_run:
-        return check_output(cmd, shell=shell)
+        return readpipe(cmd, shell=shell)
 
 
 handle_ctrl_c()
index 5da2b1a2844aff372fb136332b221416e6a3c27f..385647ec1b8f1d90e2b5ccba7f69c38626a4e55e 100644 (file)
@@ -212,9 +212,10 @@ def unlink(f):
             raise
 
 
-def readpipe(argv, preexec_fn=None):
+def readpipe(argv, preexec_fn=None, shell=False):
     """Run a subprocess and return its output."""
-    p = subprocess.Popen(argv, stdout=subprocess.PIPE, preexec_fn=preexec_fn)
+    p = subprocess.Popen(argv, stdout=subprocess.PIPE, preexec_fn=preexec_fn,
+                         shell=shell)
     out, err = p.communicate()
     if p.returncode != 0:
         raise Exception('subprocess %r failed with status %d'