Add Windows support (portable-pty / ConPTY)#8
Merged
Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Upstream portable-pty 0.9.0 (latest published) has a known Windows ConPTY bug (wezterm/wezterm#1396): spawned process produces no output and ignores input. The fix lives in wezterm master but was never published to crates.io. portable-pty-psmux is an API-compatible fork (v0.9.5) that addresses ConPTY correctness on Windows 10/11. Co-Authored-By: Claude <noreply@anthropic.com>
Windows ConPTY sends ESC[6n (cursor position report request) on startup and stalls until the host terminal replies ESC[row;colR. vibetty never replied, so the spawned shell (cmd/pwsh/claude) produced no output and ignored input. Unix shells don't send it, so macOS was unaffected. The reader thread now watches output for ESC[6n and replies ESC[1;1R through the writer thread. Also drops the temporary reader/writer debug logging. Co-Authored-By: Claude <noreply@anthropic.com>
ConPTY sends the cursor-position report request exactly once at startup, so checking every output chunk was wasted work. Scan only the first read, then stream subsequent output straight through. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
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
Replaces the Unix-only
pty-processwithportable-pty-psmuxso vibetty can spawn terminals on Windows (ConPTY) while keeping macOS/Linux working. The terminal API consumed byws.rsis unchanged.Why the fork
Stock
portable-pty0.9.0 (the latest published release) has a known Windows ConPTY bug (wez/wezterm#1396): the spawned process produces no output. The fix lives in wezterm'smasterbut was never published to crates.io.portable-pty-psmuxis an API-compatible fork that includes it.Changes
pty-process→portable-pty-psmux. Its blocking std I/O is bridged to async via twospawn_blockingthreads — a reader that pumps output to an mpsc channel, and a writer that drains an mpsc channel (each write ack'd via a one-shot).read()returnsVec<u8>(owned chunks) rather than filling a caller buffer, removing the partial-read buffering the bridge would otherwise need.$HOME; fall back to vibetty's own cwd so the child launches where vibetty was started.ESC[6n(cursor position report) on startup and stalls until the host replies. The reader thread answersESC[1;1R, scanned only on the first read.0.3.3.Tested
cmd/pwshshow banner, prompt, and command output in the TUI after theESC[6nfix.🤖 Generated with Claude Code