Use existing shell_quote function.

This commit is contained in:
Bastian Kleineidam 2010-11-10 19:49:08 +01:00
parent dc7a1a033c
commit 338e0daaa8
1 changed files with 3 additions and 7 deletions

View File

@ -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)