From dc7a1a033ce7a0b77a601a7ecda723538fed3431 Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Wed, 10 Nov 2010 19:34:25 +0100 Subject: [PATCH] Show commands that are run. --- doc/changelog.txt | 2 +- patoolib/util.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/changelog.txt b/doc/changelog.txt index 7d6f78f..65d183a 100644 --- a/doc/changelog.txt +++ b/doc/changelog.txt @@ -1,6 +1,6 @@ 0.12 "" (released xx.xx.2010) - * + * Show commands that are run. 0.11 "Primer" (released 4.10.2010) diff --git a/patoolib/util.py b/patoolib/util.py index 368b04b..ba6cc62 100644 --- a/patoolib/util.py +++ b/patoolib/util.py @@ -86,9 +86,16 @@ def backtick (cmd): return subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] +def quote_arg (arg): + if " " in arg: + return '"%s"' % arg + return arg + + def run (cmd, **kwargs): """Run command without error checking. @return: command return code""" + log_info("running %s" % " ".join(map(quote_arg, cmd))) return subprocess.call(cmd, **kwargs)