chiark / gitweb /
Log environment and cwd as well as the actual command
authorKarl Hasselström <kha@treskal.com>
Mon, 14 Apr 2008 23:18:53 +0000 (01:18 +0200)
committerKarl Hasselström <kha@treskal.com>
Tue, 15 Apr 2008 20:00:29 +0000 (22:00 +0200)
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 <kha@treskal.com>
stgit/run.py

index 77f2e6595c1639c5d2cbdabf62c46a44008a6f04..0b79729d2a5c84657fb17bd02c722ff6c699dfd2 100644 (file)
@@ -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()