Show commands that are run.

This commit is contained in:
Bastian Kleineidam 2010-11-10 19:34:25 +01:00
parent a715a7c16b
commit dc7a1a033c
2 changed files with 8 additions and 1 deletions

View File

@ -1,6 +1,6 @@
0.12 "" (released xx.xx.2010) 0.12 "" (released xx.xx.2010)
* * Show commands that are run.
0.11 "Primer" (released 4.10.2010) 0.11 "Primer" (released 4.10.2010)

View File

@ -86,9 +86,16 @@ def backtick (cmd):
return subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] 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): def run (cmd, **kwargs):
"""Run command without error checking. """Run command without error checking.
@return: command return code""" @return: command return code"""
log_info("running %s" % " ".join(map(quote_arg, cmd)))
return subprocess.call(cmd, **kwargs) return subprocess.call(cmd, **kwargs)