test(native): run the popen test program with a clean environment

This commit is contained in:
Kurt Himebauch committed 2026-11-27 22:32:40 -05:00
1 parent 536759fca7
commit 25dbc97e68
1 file changed
+2 -1
+2 -1
View File
@@ -77,7 +77,8 @@ class NativeHookPopenTest(unittest.TestCase):
def run_program(self, mode):
hook_env = {"DDNATV_ROOT": str(self.root), "LD_PRELOAD": str(self.hook)}
env = {k: v for k, v in os.environ.items() if k not in hook_env}
# Only what the program needs: other test modules in the same run change os.environ
env = {"PATH": os.environ.get("PATH", "/usr/bin:/bin")}
if self.prefix:
cmd = list(self.prefix) + [arg for key, value in hook_env.items() for arg in ("-E", f"{key}={value}")]
else: