From db09ed15fd561b89b24b979b986e21a04576f7cc Mon Sep 17 00:00:00 2001 From: Dylan Conway <35280289+dylan-conway@users.noreply.github.com> Date: Sat, 19 Aug 2023 00:11:24 -0700 Subject: tty `ReadStream`, `WriteStream`, and readline rawmode (#4179) * tty `WriteStream`, `ReadStream`, and rawmode * tests * refactor prototypes * fix failing test * fix test and library usage * more merge * fix child_process test * create pseudo terminal for tty tests * match node logic * handle invalid tty * close descriptors * move tests to another process * fix test again * fix test on linux --- src/js/builtins/ReadableStreamInternals.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/js/builtins/ReadableStreamInternals.ts') diff --git a/src/js/builtins/ReadableStreamInternals.ts b/src/js/builtins/ReadableStreamInternals.ts index 58fa4524a..e249aea0a 100644 --- a/src/js/builtins/ReadableStreamInternals.ts +++ b/src/js/builtins/ReadableStreamInternals.ts @@ -1504,7 +1504,12 @@ export function lazyLoadStream(stream, autoAllocateChunkSize) { function callClose(controller) { try { - controller.close(); + if ( + $getByIdDirectPrivate($getByIdDirectPrivate(controller, "controlledReadableStream"), "state") === + $streamReadable + ) { + controller.close(); + } } catch (e) { globalThis.reportError(e); } -- cgit v1.2.3