fix: fix PTY test failures — stdin double-processing, raw mode exit hang, fixture JSX
Three runtime bugs and fixture issues fixed: 1. stdin registered both "readable" and "data" handlers, causing double input processing in real PTY. Now only uses "data" handler (works for both real TTY and fake PassThrough streams). 2. dispose() didn't call stdin.unref() after restoring raw mode, keeping the event loop alive and causing raw mode exit tests to hang. 3. PTY fixtures used JSX syntax which tsx compiles without vue-jsx plugin, producing non-function slot values. Converted to h() with function slots. Also: term.ts now passes rows arg to node-pty for viewport-dependent tests, and exit-double-raw-mode fixture uses __READY__ protocol. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -882,7 +882,6 @@ function createStdinController(
|
||||
if (typeof stdin.ref === "function") stdin.ref();
|
||||
if (typeof (stdin as any).setEncoding === "function") (stdin as any).setEncoding("utf8");
|
||||
appCtx.setRawMode(true);
|
||||
stdin.on("readable", handleReadable);
|
||||
stdin.on("data", handleData);
|
||||
}
|
||||
state.refs++;
|
||||
@@ -939,6 +938,7 @@ function createStdinController(
|
||||
if (state.refs === 0 && state.prevRaw !== null) {
|
||||
appCtx.setRawMode(state.prevRaw);
|
||||
state.prevRaw = null;
|
||||
if (typeof stdin.unref === "function") stdin.unref();
|
||||
inputParser.reset();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user