From 338e0daaa87d096fc3e12af3c03de93fabb93237 Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Wed, 10 Nov 2010 19:49:08 +0100 Subject: [PATCH] Use existing shell_quote function. --- patoolib/util.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/patoolib/util.py b/patoolib/util.py index ba6cc62..878fe12 100644 --- a/patoolib/util.py +++ b/patoolib/util.py @@ -86,16 +86,12 @@ 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))) + args = (" ".join(map(shell_quote, cmd)), + ", ".join("%s=%s" % (k, shell_quote(v)) for k, v in kwargs.items())) + log_info("running %s with %s" % args) return subprocess.call(cmd, **kwargs)