Fix /dev/tty open on Windows in _start_stdout_capture!#40
Open
mind6 wants to merge 1 commit into
Open
Conversation
`/dev/tty` is Unix-only; on Windows the equivalent controlling-terminal
device is `CON`. Without this, `kaimon` crashes at startup on Windows
with `SystemError: opening file "/dev/tty": No such file or directory`.
Verified on Windows 11 / Julia 1.12.5 — `open("CON", "w")` returns a
writable handle to the console that survives `redirect_stdout`, which is
what `_TUI_REAL_STDOUT` is used for (assigned to `Tachikoma.Terminal.io`
in `tui/lifecycle.jl:213`).
4 tasks
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
On Windows, running
kaimoncrashes at startup with:/dev/ttyis Unix-only. On Windows the equivalent controlling-terminal device isCON. This PR usesSys.iswindows()to pick the right path.Why this matters
_TUI_REAL_STDOUTholds a handle to the real terminal that survivesredirect_stdout(), and that handle is later assigned toTachikoma.Terminal.io(src/tui/lifecycle.jl:213) so the TUI can render even whilestdoutis being captured into the Server log buffer. Without a working terminal handle on Windows, the TUI can't start at all.Test plan
open("CON", "w")returns a writable console handle on Windows 11 / Julia 1.12.5.kaimonproceeds past_start_stdout_capture!and into TUI init (a separate, unrelatedZMQ: Protocol not supportederror fromipc://sockets ingate_client.jlis the next Windows blocker — out of scope for this PR; happy to file an issue)./dev/tty).Note on broader Windows support
This is a one-line compatibility fix and does not claim to make Kaimon fully Windows-ready. The ZMQ IPC transport (
ipc://) is also unavailable on Windows in the standardZMQ_jllbuild, which would need a separate fix (e.g. switching totcp://127.0.0.1:<port>or a Windows-named-pipe transport). Filing that as a separate issue.