From b2753e7d718619cfcd7192793ca374f6cafaee96 Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Fri, 8 Jul 2016 20:13:46 -0500 Subject: [PATCH] import-duplicity: use readpipe, not check_output Python 2.6 doesn't have check_output. Signed-off-by: Rob Browning Tested-by: Rob Browning --- cmd/import-duplicity-cmd.py | 6 +++--- lib/bup/helpers.py | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cmd/import-duplicity-cmd.py b/cmd/import-duplicity-cmd.py index ff37daf..0d4f559 100755 --- a/cmd/import-duplicity-cmd.py +++ b/cmd/import-duplicity-cmd.py @@ -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() diff --git a/lib/bup/helpers.py b/lib/bup/helpers.py index 5da2b1a..385647e 100644 --- a/lib/bup/helpers.py +++ b/lib/bup/helpers.py @@ -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' -- 2.39.2