summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
29f0500)
Python 2.6 doesn't have check_output.
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
from calendar import timegm
from pipes import quote
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 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 = """
import bup.path
optspec = """
global opt
logcmd(cmd)
if not opt.dry_run:
global opt
logcmd(cmd)
if not opt.dry_run:
- return check_output(cmd, shell=shell)
+ return readpipe(cmd, shell=shell)
-def readpipe(argv, preexec_fn=None):
+def readpipe(argv, preexec_fn=None, shell=False):
"""Run a subprocess and return its output."""
"""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'
out, err = p.communicate()
if p.returncode != 0:
raise Exception('subprocess %r failed with status %d'