Use existing shell_quote function.
This commit is contained in:
parent
dc7a1a033c
commit
338e0daaa8
|
@ -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)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue