Skip to content

Commit c620532

Browse files
bugfix: start_process ensuring passing of TMPDIR when needed (#922)
1 parent 03da7f2 commit c620532

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

gprofiler/utils/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,12 @@ def start_process(
146146
# see https://github.com/JonathonReinhart/staticx#run-time-information
147147
cmd = [f"{staticx_dir}/.staticx.interp", "--library-path", staticx_dir] + cmd
148148
else:
149-
# explicitly remove our directory from LD_LIBRARY_PATH
150149
env = env if env is not None else os.environ.copy()
151-
env.update({"LD_LIBRARY_PATH": ""})
150+
# ensure `TMPDIR` env is propagated to the child processes (used by staticx)
151+
if "TMPDIR" not in env and "TMPDIR" in os.environ:
152+
env["TMPDIR"] = os.environ["TMPDIR"]
153+
# explicitly remove our directory from LD_LIBRARY_PATH
154+
env["LD_LIBRARY_PATH"] = ""
152155

153156
if is_windows():
154157
cur_preexec_fn = None # preexec_fn is not supported on Windows platforms. subprocess.py reports this.

0 commit comments

Comments
 (0)