deno
2cc8415e - fix(ext/node): fix Windows TTY console mode restoration, output encoding, and read blocking

Commit
113 days ago
fix(ext/node): fix Windows TTY console mode restoration, output encoding, and read blocking Three fixes for Windows TTY regressions introduced in the node:tty rewrite (#32777): 1. Restore saved console mode for NORMAL: uv_tty_set_mode(NORMAL) was setting a hardcoded subset of flags (ECHO|LINE|PROCESSED = 0x0007), losing ENABLE_QUICK_EDIT_MODE, ENABLE_INSERT_MODE, and ENABLE_EXTENDED_FLAGS that Windows sets by default. Now restores the original mode saved at init time, matching libuv behavior. 2. Use WriteConsoleW for TTY output: WriteFile writes raw bytes interpreted by the console's active code page, garbling non-ASCII output (box-drawing chars, Unicode) when the code page isn't UTF-8. Now converts UTF-8 to UTF-16 and calls WriteConsoleW, matching libuv. 3. Re-check events before each read: the Windows read loop evaluated GetNumberOfConsoleInputEvents once and looped with a stale boolean, so ReadFile could block the event loop after consuming all available events. Now re-checks before each ReadFile call. Fixes #32996 Fixes #32997 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
Parents
Loading