diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-06-02 07:36:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-02 07:36:51 +0200 |
commit | c908088a039b8e1232941850c75471bab162313a (patch) | |
tree | d54c01abc75a4f1bab748622b7b3009587ba916f /cli/tests/unit_node/process_test.ts | |
parent | 11791ee2608a402d5067dcdf8bb088cbd6689c18 (diff) |
fix(node): don't close stdio streams (#19256)
Closes https://github.com/denoland/deno/issues/19255
---------
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
Diffstat (limited to 'cli/tests/unit_node/process_test.ts')
-rw-r--r-- | cli/tests/unit_node/process_test.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/cli/tests/unit_node/process_test.ts b/cli/tests/unit_node/process_test.ts index 49b753db3..7e927a8ad 100644 --- a/cli/tests/unit_node/process_test.ts +++ b/cli/tests/unit_node/process_test.ts @@ -2,6 +2,8 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. import process, { argv, env } from "node:process"; +import { Readable } from "node:stream"; +import { once } from "node:events"; import { assert, assertEquals, @@ -746,3 +748,19 @@ Deno.test({ assertEquals(stripColor(decoder.decode(stdout).trim()), "really exited"); }, }); + +Deno.test({ + name: "process.stdout isn't closed when source stream ended", + async fn() { + const source = Readable.from(["foo", "bar"]); + + source.pipe(process.stdout); + await once(source, "end"); + + // Wait a bit to ensure that streaming is completely finished. + await delay(10); + + // This checks if the rid 1 is still valid. + assert(typeof process.stdout.isTTY === "boolean"); + }, +}); |