From fa2fa45e4ea2e767e1b678b4f303d0f64846df1a Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Tue, 15 Apr 2008 01:18:53 +0200 Subject: [PATCH] Log environment and cwd as well as the actual command MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Organization: Straylight/Edgeware From: Karl Hasselström When debugging subprocess calls (with STGIT_SUBPROCESS_LOG=debug), it's important to know the environment and working directory we pass to the subprocess, not just the command-line parameters. Signed-off-by: Karl Hasselström --- stgit/run.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/stgit/run.py b/stgit/run.py index 77f2e65..0b79729 100644 --- a/stgit/run.py +++ b/stgit/run.py @@ -48,6 +48,12 @@ class Run: def __log_start(self): if _log_mode == 'debug': out.start('Running subprocess %s' % self.__cmd) + if self.__cwd != None: + out.info('cwd: %s' % self.__cwd) + if self.__env != None: + for k in sorted(self.__env.iterkeys()): + if k not in os.environ or os.environ[k] != self.__env[k]: + out.info('%s: %s' % (k, self.__env[k])) elif _log_mode == 'profile': out.start('Running subprocess %s' % self.__cmd[0]) self.__starttime = datetime.datetime.now() -- [mdw]