fix demo readline terminal editing

This commit is contained in:
Yichen Jiang
2026-06-19 09:58:39 +08:00
parent c5049d1c3f
commit 5189c99543
6 changed files with 79 additions and 3 deletions

View File

@@ -53,7 +53,11 @@ export function apply(ctx: Context) {
})
ctx.effect(() => {
const reader = createInterface({ input: process.stdin })
const reader = createInterface({
input: process.stdin,
output: process.stdout,
terminal: process.stdin.isTTY && process.stdout.isTTY,
})
// Piped-input exit, once stdin reaches EOF:
// - If no line ever submitted work (empty stdin, blank-only lines), exit
// immediately — no turn will ever start, so there is nothing to wait