Skip to content

Fix /dev/tty open on Windows in _start_stdout_capture!#40

Open
mind6 wants to merge 1 commit into
kahliburke:mainfrom
mind6:fix/windows-dev-tty
Open

Fix /dev/tty open on Windows in _start_stdout_capture!#40
mind6 wants to merge 1 commit into
kahliburke:mainfrom
mind6:fix/windows-dev-tty

Conversation

@mind6
Copy link
Copy Markdown

@mind6 mind6 commented May 9, 2026

Summary

On Windows, running kaimon crashes at startup with:

ERROR: SystemError: opening file "/dev/tty": No such file or directory
 [6] _start_stdout_capture!()
   @ Kaimon .../src/tui/io.jl:211

/dev/tty is Unix-only. On Windows the equivalent controlling-terminal device is CON. This PR uses Sys.iswindows() to pick the right path.

Why this matters

_TUI_REAL_STDOUT holds a handle to the real terminal that survives redirect_stdout(), and that handle is later assigned to Tachikoma.Terminal.io (src/tui/lifecycle.jl:213) so the TUI can render even while stdout is being captured into the Server log buffer. Without a working terminal handle on Windows, the TUI can't start at all.

Test plan

  • Verified open("CON", "w") returns a writable console handle on Windows 11 / Julia 1.12.5.
  • After patch, kaimon proceeds past _start_stdout_capture! and into TUI init (a separate, unrelated ZMQ: Protocol not supported error from ipc:// sockets in gate_client.jl is the next Windows blocker — out of scope for this PR; happy to file an issue).
  • Patch is a no-op on Unix (still uses /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 standard ZMQ_jll build, which would need a separate fix (e.g. switching to tcp://127.0.0.1:<port> or a Windows-named-pipe transport). Filing that as a separate issue.

`/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`).
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