fix(windows): guard fcntl/termios import + add __main__.py launcher - #21465
Closed
Alterpolo wants to merge 3 commits into
Closed
fix(windows): guard fcntl/termios import + add __main__.py launcher#21465Alterpolo wants to merge 3 commits into
Alterpolo wants to merge 3 commits into
Conversation
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>
Collaborator
tcflying
added a commit
to tcflying/hermes-agent-windows-rust-old
that referenced
this pull request
May 15, 2026
- psutil-based process start time fallback (NousResearch#25502) - ConPTY Bridge for native Windows terminal support - prompt_toolkit Vt100 output fallback for Git Bash - Git Bash path resolution (/d/path -> D:\path) - UTF-8 encoding for subprocess calls (doctor, schtasks) - Bash forward slashes in cron scripts (NousResearch#23404) - schtasks mbcs encoding for non-ASCII task names (NousResearch#24417, NousResearch#24478) - __main__.py launcher for python -m hermes_cli (NousResearch#21465) - shutdown_forensics Windows process snapshot - Comprehensive E2E test suite with 23 tests Fixes Windows native installation without WSL2 requirement. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Contributor
|
Closing as superseded by #42251, which adds a real ConPTY backend instead of import-guarding the POSIX bridge. Your PR was the right shape for keeping the non-chat dashboard tabs alive on Windows when only |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two small fixes for native Windows Python compatibility:
hermes_cli/__main__.py— adds the standard package entry-point so Hermes can be invoked aspython -m hermes_clifrom a cloned repo or CI environment where thehermesbinary is not on PATH. Delegates unconditionally tohermes_cli.main:main(); behaviour is byte-identical to the installed command for all subcommands and exit codes.hermes_cli/pty_bridge.py— guardsfcntl/termiosimports behind atry/except ImportError. Both modules are POSIX-only and absent from native Windows Python. The module already gates PTY operations on_PTY_AVAILABLEand raisesPtyUnavailableErrorat instantiation; only the import needs to succeed. Without this guard, any command that triggersweb_server.py(which importspty_bridgeunconditionally) crashes at module-load time on Windows — even commands unrelated to the PTY bridge.scripts/release.py— contributor email mapping for this PR's author.Test plan
python -m hermes_cli --versionon a repo checkout (no installed binary) → version string on stdout, exit 0python -m hermes_cli doctor→ same output ashermes doctorpython -c "import hermes_cli.pty_bridge"→ no ImportErrorruff check hermes_cli/__main__.py hermes_cli/pty_bridge.py→ no errors🤖 Generated with Claude Code