Skip to content

fix(windows): guard fcntl/termios import + add __main__.py launcher - #21453

Closed
Alterpolo wants to merge 2 commits into
NousResearch:mainfrom
Alterpolo:fix/windows-compat-launcher
Closed

fix(windows): guard fcntl/termios import + add __main__.py launcher#21453
Alterpolo wants to merge 2 commits into
NousResearch:mainfrom
Alterpolo:fix/windows-compat-launcher

Conversation

@Alterpolo

Copy link
Copy Markdown

Summary

Two small fixes for native Windows Python compatibility:

  • hermes_cli/__main__.py — adds the standard package entry-point so Hermes can be invoked as python -m hermes_cli from a cloned repo or CI environment where the hermes binary is not on PATH. Delegates unconditionally to hermes_cli.main:main(); behaviour is byte-identical to the installed command for all subcommands and exit codes.

  • hermes_cli/pty_bridge.py — guards fcntl/termios imports behind a try/except ImportError. Both modules are POSIX-only and absent from native Windows Python. The module already gates PTY operations on _PTY_AVAILABLE and raises PtyUnavailableError at instantiation; only the import needs to succeed. Without this guard, any command that triggers web_server.py (which imports pty_bridge unconditionally) crashes at module-load time on Windows — even commands unrelated to the PTY bridge.

Test plan

  • python -m hermes_cli --version on a repo checkout (no installed binary) → version string on stdout, exit 0
  • python -m hermes_cli doctor → same output as hermes doctor
  • On Windows native Python: python -c "import hermes_cli.pty_bridge" → no ImportError
  • hermes_cli/pty_bridge.py passes ruff check and mypy --strict

🤖 Generated with Claude Code

Alterpolo and others added 2 commits May 7, 2026 21:13
Adds the standard Python package entry-point so that Hermes can be
invoked as `python -m hermes_cli` from a cloned repo or CI environment
where the `hermes` binary is not on PATH.

The file delegates unconditionally to `hermes_cli.main:main()` with no
argument or environment mutation, keeping behaviour byte-identical to the
installed command for all subcommands and exit codes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fcntl and termios are POSIX-only and absent from native Windows Python.
The module already gates PTY operations on _PTY_AVAILABLE and raises
PtyUnavailableError at instantiation, so only the import needs to
succeed.

Without this guard, any command that triggers web_server.py (which
imports pty_bridge unconditionally) crashes at module-load time on
Windows — even commands that have nothing to do with the PTY bridge.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/cli CLI entry point, hermes_cli/, setup wizard labels May 7, 2026
@Alterpolo Alterpolo closed this May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants