diff --git a/gprofiler/utils/__init__.py b/gprofiler/utils/__init__.py index 2fad553bd..e93483c6b 100644 --- a/gprofiler/utils/__init__.py +++ b/gprofiler/utils/__init__.py @@ -146,9 +146,12 @@ def start_process( # see https://github.com/JonathonReinhart/staticx#run-time-information cmd = [f"{staticx_dir}/.staticx.interp", "--library-path", staticx_dir] + cmd else: - # explicitly remove our directory from LD_LIBRARY_PATH env = env if env is not None else os.environ.copy() - env.update({"LD_LIBRARY_PATH": ""}) + # ensure `TMPDIR` env is propagated to the child processes (used by staticx) + if "TMPDIR" not in env and "TMPDIR" in os.environ: + env["TMPDIR"] = os.environ["TMPDIR"] + # explicitly remove our directory from LD_LIBRARY_PATH + env["LD_LIBRARY_PATH"] = "" if is_windows(): cur_preexec_fn = None # preexec_fn is not supported on Windows platforms. subprocess.py reports this.