feat: stdin.ref/unref, raw mode default false, conditional listener, maxListeners

- stdin.ref() on raw mode enable, stdin.unref() on disable
- setEncoding("utf8") on raw mode enable
- Raw mode default changed from true to false (hooks acquire it)
- useStdin().setRawMode routed through ref-counted controller
- Stdin listeners attached only when raw mode is active
- EventEmitter maxListeners set to Infinity

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yunfei He
2026-05-26 22:22:58 +08:00
parent 05c4dd5076
commit 3422e6edc1
3 changed files with 19 additions and 15 deletions
+2
View File
@@ -34,5 +34,7 @@ export function makeFakeStdin(): { stream: NodeJS.ReadStream; rawMode: RawModeSt
return this;
},
});
(s as any).ref = () => {};
(s as any).unref = () => {};
return { stream: s, rawMode };
}