fix(execution): provide host_tty.isatty/get_size + real set_raw_mode for wasm-c TTY guests#167
Merged
Merged
Conversation
…for wasm-c TTY guests
wasm-runner.mjs's host_tty import only provided read() + a stubbed set_raw_mode,
missing isatty/get_size — so any wasm-c program importing host_tty.{isatty,get_size}
(pty_probe, vim) failed to instantiate (LinkError) and produced no output. Wire all
three to the existing kernel sync-RPCs (__kernel_isatty / __kernel_tty_size /
__pty_set_raw_mode) already served on the same dispatch as __kernel_stdin_read.
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.
Fixes wasm-c TTY guests (pty_probe, vim) that couldn't run under the converged runtime.
crates/execution/assets/runners/wasm-runner.mjs'shost_ttyimport object only providedread()and a stubbedset_raw_modethat returned 0 — it was missingisattyandget_size. Any wasm-c program that importshost_tty.{isatty,get_size}(the "termios bridge" — used bypty_probe, vim, and any crossterm/termios guest) therefore failed to instantiate with aLinkErroron the missing imports, produced no output, and hung.This wires all three to the kernel sync-RPCs that already exist and are served on the same dispatch as the working
__kernel_stdin_read:isatty(fd)→__kernel_isattyget_size(fd, colsPtr, rowsPtr)→__kernel_tty_size(writes two LE u16s)set_raw_mode(enabled)→__pty_set_raw_mode(was a no-op stub)Root-caused by debugging the recovered
pty-line-disciplineintegration test (agent-os), whosewasm-cmatrix all timed out with an empty screen because the probe never instantiated. Complements secure-exec#166 (kernel line-editing): #166 made the kernel do echo/VKILL/VWERASE; this makes the guest able to reach it.