Skip to content

The agent that grows with you

test(desktop): neutralize the Linux desktop-entry install in the Ctrl-C exit test

Hermes Agent3f2c24d41fac
diff --git a/tests/hermes_cli/test_gui_command.py b/tests/hermes_cli/test_gui_command.py
index c7c066a007a..e78679213ac 100644
--- a/tests/hermes_cli/test_gui_command.py
+++ b/tests/hermes_cli/test_gui_command.py
@@ -1125,6 +1125,12 @@ def test_gui_foreground_launch_ctrl_c_exits_cleanly(tmp_path, monkeypatch, capsy
"""
root = _make_desktop_tree(tmp_path)
monkeypatch.setattr(cli_main, "PROJECT_ROOT", root)
+ # Patching hermes_cli.main.subprocess.run swaps the shared stdlib module's
+ # attribute, so EVERY subprocess.run in the process raises. On Linux the
+ # best-effort desktop-entry install runs refresh_desktop_databases →
+ # subprocess.run BEFORE the attached launch — outside the KeyboardInterrupt
+ # handler under test — so neutralize it like the other foreground tests do.
+ monkeypatch.setattr(main_desktop, "_register_linux_desktop_entry", lambda **kw: None)
packaged_exe = _make_packaged_executable(root, monkeypatch)
ok = subprocess.CompletedProcess([], 0)