From 695b5de6cb0cb4a10b95cbae99f2f19e5621a9eb Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Thu, 18 May 2023 14:02:14 +0200 Subject: fix(node): support passing parent stdio streams (#19171) This is a bit bare bones but gets `npm-run-all` working. For full stdio compatibility with node more work is needed which is probably better done in follow up PRs. Fixes #19159 --- cli/tests/unit_node/child_process_test.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'cli/tests/unit_node/child_process_test.ts') diff --git a/cli/tests/unit_node/child_process_test.ts b/cli/tests/unit_node/child_process_test.ts index b40cfd9ff..e89fd7d79 100644 --- a/cli/tests/unit_node/child_process_test.ts +++ b/cli/tests/unit_node/child_process_test.ts @@ -577,3 +577,25 @@ Deno.test( assertStringIncludes(output, "typescript"); }, ); + +Deno.test( + "[node/child_process spawn] supports stdio array option", + async () => { + const cmdFinished = deferred(); + let output = ""; + const script = path.join( + path.dirname(path.fromFileUrl(import.meta.url)), + "testdata", + "child_process_stdio.js", + ); + const cp = spawn(Deno.execPath(), ["run", "-A", script]); + cp.stdout?.on("data", (data) => { + output += data; + }); + cp.on("close", () => cmdFinished.resolve()); + await cmdFinished; + + assertStringIncludes(output, "foo"); + assertStringIncludes(output, "close"); + }, +); -- cgit v1.2.3