Improved command execution logging.
This commit is contained in:
parent
79493755c5
commit
0d7a90e0f0
|
@ -89,9 +89,12 @@ def backtick (cmd):
|
||||||
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"""
|
||||||
args = (" ".join(map(shell_quote, cmd)),
|
# Note that shell_quote_nt() result is not suitable for copy-paste
|
||||||
", ".join("%s=%s" % (k, shell_quote(v)) for k, v in kwargs.items()))
|
# (especially on Unix systems), but it looks nicer than shell_quote().
|
||||||
log_info("running %s with %s" % args)
|
log_info("running %s" % " ".join(map(shell_quote_nt, cmd)))
|
||||||
|
if kwargs:
|
||||||
|
log_info(" with %s" % ", ".join("%s=%s" % (k, shell_quote(str(v)))\
|
||||||
|
for k, v in kwargs.items()))
|
||||||
return subprocess.call(cmd, **kwargs)
|
return subprocess.call(cmd, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,6 +106,7 @@ def run_checked (cmd, **kwargs):
|
||||||
raise PatoolError(msg)
|
raise PatoolError(msg)
|
||||||
return retcode
|
return retcode
|
||||||
|
|
||||||
|
|
||||||
@memoized
|
@memoized
|
||||||
def guess_mime (filename):
|
def guess_mime (filename):
|
||||||
"""Guess the MIME type of given filename using file(1) and if that
|
"""Guess the MIME type of given filename using file(1) and if that
|
||||||
|
|
Loading…
Reference in New Issue