The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: keep source observer read-only and PTY fixture reusable
ethernetebf127c33ddb
diff --git a/hermes_cli/_launchers.py b/hermes_cli/_launchers.pyindex 2113c52932a..99dcb17691e 100644--- a/hermes_cli/_launchers.py+++ b/hermes_cli/_launchers.py@@ -229,10 +229,10 @@ def _launcher_script(name: str, repo_root: Path, dependencies: Path | None) -> s"os.environ.pop('PYTHONHOME', None)\n""os.environ.pop('PYTHONPATH', None)\n"f"sys.path.insert(0, {str(repo_root.resolve())!r})\n"+ "if sys.argv[1:2] == ['--print-runtime-command']: sys.dont_write_bytecode = True\n""from hermes_constants import get_default_hermes_root\n""os.environ['HERMES_HOME'] = os.environ.get('HERMES_HOME') or str(get_default_hermes_root())\n""if sys.argv[1:2] == ['--print-runtime-command']:\n"- " sys.dont_write_bytecode = True\n"" from pathlib import Path\n"" from hermes_cli._launchers import print_runtime_command\n"f" print_runtime_command(Path({str(repo_root.resolve())!r}), sys.argv[2:])\n"diff --git a/tests/scripts/test_install_sh_launch_handoff.py b/tests/scripts/test_install_sh_launch_handoff.pyindex 49fb0c6dffb..f80353e26b7 100644--- a/tests/scripts/test_install_sh_launch_handoff.py+++ b/tests/scripts/test_install_sh_launch_handoff.py@@ -13,10 +13,8 @@ if os.name == 'posix':ROOT = Path(__file__).resolve().parents[2]-def _with_controlling_terminal(slave: int):- """preexec_fn: make ``slave`` this child's controlling terminal, so /dev/tty opens."""- tty_path = os.ttyname(slave)-+def _with_controlling_terminal(tty_path: str):+ """preexec_fn: make this PTY the child's controlling terminal, so /dev/tty opens."""def attach() -> None:os.setsid() # windows-footgun: ok (posix-only test)fd = os.open(tty_path, os.O_RDWR)@@ -38,16 +36,19 @@ def test_installer_post_pm_stages(tmp_path: Path, stage: str, expected: list[strassert result.returncode == 0, result.stdout + result.stderrassert not calls.exists()master, slave = pty.openpty()+ try:+ tty_path = os.ttyname(slave)+ finally:+ os.close(slave)try:for code in [0, 9]:result = subprocess.run(command, cwd=tmp_path, env={**env, 'STAGE_EXIT': str(code)}, capture_output=True,- text=True, encoding='utf-8', timeout=20, stdin=subprocess.DEVNULL, preexec_fn=_with_controlling_terminal(slave),- pass_fds=(slave,))+ text=True, encoding='utf-8', timeout=20, stdin=subprocess.DEVNULL,+ preexec_fn=_with_controlling_terminal(tty_path))assert (result.returncode == 0) == (code == 0), result.stdout + result.stderrassert json.loads(calls.read_text()) == expectedfinally:os.close(master)- os.close(slave)assert not (install / 'venv').exists()