about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/glean-sdk/fix-spawned-process-environment.patch
blob: f9a7b2723eba235f183b7052b192c99241932fc5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/glean-core/python/glean/_process_dispatcher.py b/glean-core/python/glean/_process_dispatcher.py
index 33a8b12796..a39b54a917 100644
--- a/glean-core/python/glean/_process_dispatcher.py
+++ b/glean-core/python/glean/_process_dispatcher.py
@@ -120,8 +120,14 @@ def dispatch(cls, func, args) -> Union[_SyncWorkWrapper, subprocess.Popen]:
                     Path(".coveragerc").absolute()
                 )
 
+            # Explicitly pass the contents of `sys.path` as `PYTHONPATH` to the
+            # subprocess so that there aren't any module search path
+            # differences.
+            python_path = ":".join(sys.path)[1:]
+
             p = subprocess.Popen(
-                [sys.executable, _process_dispatcher_helper.__file__, payload]
+                [sys.executable, _process_dispatcher_helper.__file__, payload],
+                env={"PYTHONPATH": python_path},
             )
 
             cls._last_process = p