Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions hermes_cli/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env python3
"""
Hermes Agent CLI launcher.

This wrapper should behave like the installed `hermes` command, including
subcommands such as `gateway`, `cron`, and `doctor`.
"""

if __name__ == "__main__":
from hermes_cli.main import main
main()
16 changes: 14 additions & 2 deletions hermes_cli/pty_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,28 @@
from __future__ import annotations

import errno
import fcntl
import os
import select
import signal
import struct
import sys
import termios
import time
from typing import Optional, Sequence

# fcntl and termios are POSIX-only. The module guards PTY operations on
# `_PTY_AVAILABLE` and raises `PtyUnavailableError` at instantiation time,
# so the import just needs to succeed on Windows. Without this guard, any
# command that triggers web_server.py (which imports pty_bridge
# unconditionally) crashes at module-load time on native Windows Python.
try:
import fcntl
import termios
_UNIX_TERMIO_AVAILABLE = True
except ImportError: # Windows
fcntl = None # type: ignore
termios = None # type: ignore
_UNIX_TERMIO_AVAILABLE = False

try:
import ptyprocess # type: ignore
_PTY_AVAILABLE = not sys.platform.startswith("win")
Expand Down