Skip to content

fix: read ProxyCommand stdin with a blocking os.read instead of select() - #158

Open
0Cymantek0 wants to merge 1 commit into
googlecolab:mainfrom
0Cymantek0:fix/ssh-proxy-command-stdin
Open

0Cymantek0 wants to merge 1 commit into
googlecolab:mainfrom
0Cymantek0:fix/ssh-proxy-command-stdin

Conversation

@0Cymantek0

Copy link
Copy Markdown

On Windows the stdin pump in colab ssh --proxy-mode dies at startup. select() only accepts sockets there, so the call on the stdin fd raises OSError, the pump thread exits, and the runtime never receives any input. ssh hangs with no way to type.

The select() call waited on a single fd with no timeout, so a blocking os.read() is equivalent on POSIX and also works on Windows. The pump direction had no test coverage (the existing bridge test stubs the reader thread out), so this adds test_bridge_proxy_mode_pumps_stdin_to_ws. It fails with the select() call in place on Windows and passes with the blocking read.

Part of the Windows breakage in #85 and #100. The termios crash at startup is separate and already covered by #135.

Verified on Windows 11 with Python 3.12: ruff check clean, all ssh bridge tests pass, and the full suite shows no new failures (the remaining ones are pre-existing platform issues: SIGHUP, prompt_toolkit win32, rich help sorting).

Merge ready.

Windows select() only accepts sockets, so in --proxy-mode the stdin pump
died with OSError before any input was forwarded, leaving the runtime
without a stdin. A blocking os.read() is equivalent on POSIX (the select
waited on just this one fd with no timeout) and works everywhere.

The pump direction had no coverage (the existing bridge test stubs the
reader thread out), so this adds test_bridge_proxy_mode_pumps_stdin_to_ws,
which fails with the select() call in place on Windows and passes with
the blocking read on every platform.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant