Skip to content

The agent that grows with you

fix(update): run the libatomic pre-install spawn only on Linux

kshitijk4pooraf90026aa099
diff --git a/hermes_cli/update_completion.py b/hermes_cli/update_completion.py
index 7bfbe47ac7f..cb5df28accf 100644
--- a/hermes_cli/update_completion.py
+++ b/hermes_cli/update_completion.py
@@ -42,10 +42,11 @@ def run_completion(request: dict) -> dict:
# this is the last point where sudo can ask for a password. Run the new
# tree's pre-install as its own process (this parent stays stdlib-only); a
# tree without it, or any failure, just leaves the in-lock repair to report.
- subprocess.run([sys.executable, "-I", "-S", "-B", "-c",
- "import sys; sys.path.insert(0, sys.argv[1]); "
- "from pm.libatomic import install_before_lock; install_before_lock()", str(root)],
- cwd=root, stdout=None, stderr=subprocess.DEVNULL, check=False)
+ if sys.platform.startswith("linux"):
+ subprocess.run([sys.executable, "-I", "-S", "-B", "-c",
+ "import sys; sys.path.insert(0, sys.argv[1]); "
+ "from pm.libatomic import install_before_lock; install_before_lock()", str(root)],
+ cwd=root, stdout=None, stderr=subprocess.DEVNULL, check=False)
env = dict(os.environ, HERMES_HOME=request["home"], PYTHONUNBUFFERED="1")
for key in ("PYTHONPATH", "PYTHONHOME", "VIRTUAL_ENV"):
env.pop(key, None)
diff --git a/tests/pm/test_node_libatomic_install_boundary.py b/tests/pm/test_node_libatomic_install_boundary.py
index 52526a088b6..0d7f2967c96 100644
--- a/tests/pm/test_node_libatomic_install_boundary.py
+++ b/tests/pm/test_node_libatomic_install_boundary.py
@@ -100,6 +100,7 @@ def test_update_completion_installs_before_detaching(monkeypatch):
"""run_completion's child has no controlling terminal; the pre-install runs first, in-session."""
from hermes_cli import update_completion
+ monkeypatch.setattr(update_completion.sys, "platform", "linux")
calls = []
monkeypatch.setattr(update_completion.subprocess, "run",
lambda argv, **kw: calls.append(("run", argv, kw)))