git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[StGit PATCH 2/2] Log environment and cwd as well as the actual command

From
Karl Hasselström <kha@treskal.com>
Date
Apr 12, 2008, 15:47 UTC
Message-ID
<20080412154727.19690.60228.stgit@yoghurt>
In-Reply-To
<20080412154427.19690.71877.stgit@yoghurt>

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 |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
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()
Previous: Karl Hasselström
Message 3 of 3 in “Fix stg breakage with nweer gits”
  1. 0/2 Fix stg breakage with nweer gitsKarl Hasselström, Apr 12, 2008
  2. 1/2 Don't both change directory and set GIT_WORK_TREEKarl Hasselström, Apr 12, 2008
  3. 2/2 Log environment and cwd as well as the actual commandKarl Hasselström, Apr 12, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.