From 0d7a90e0f0dadc1cc0a6f8ee061d9fa35fc0da62 Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Mon, 15 Nov 2010 21:29:19 +0100 Subject: [PATCH] Improved command execution logging. --- patoolib/util.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/patoolib/util.py b/patoolib/util.py index 878fe12..ec113d1 100644 --- a/patoolib/util.py +++ b/patoolib/util.py @@ -89,9 +89,12 @@ def backtick (cmd): def run (cmd, **kwargs): """Run command without error checking. @return: command return code""" - 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) + # Note that shell_quote_nt() result is not suitable for copy-paste + # (especially on Unix systems), but it looks nicer than shell_quote(). + 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) @@ -103,6 +106,7 @@ def run_checked (cmd, **kwargs): raise PatoolError(msg) return retcode + @memoized def guess_mime (filename): """Guess the MIME type of given filename using file(1) and if that