From f5c1ff08e6c67c38043b4c76b5472ad71c93d697 Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Fri, 2 Jun 2023 17:46:50 +0200 Subject: fix(node): map stdio [0, 1, 2] to "inherit" (#19352) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Internally, `node-tap` spawns a child process with `stdio: [0, 1, 2]`. Whilst we don't support passing fd numbers as an argument so far, it turns out that `[0, 1, 2]` is equivalent to `"inherit"` which we already support. See: https://nodejs.org/api/child_process.html#optionsstdio Mapping it to `"inherit"` is fine for us and gets us one step closer in getting `node-tap` working. I'm now at the stage where already the coverage table is shown 🎉 --- ext/node/polyfills/internal/child_process.ts | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ext/node/polyfills/internal/child_process.ts') diff --git a/ext/node/polyfills/internal/child_process.ts b/ext/node/polyfills/internal/child_process.ts index 365af4add..d4acf1db2 100644 --- a/ext/node/polyfills/internal/child_process.ts +++ b/ext/node/polyfills/internal/child_process.ts @@ -469,6 +469,13 @@ function normalizeStdioOption( ...Array, ] { if (Array.isArray(stdio)) { + // `[0, 1, 2]` is equivalent to `"inherit"` + if ( + stdio.length === 3 && stdio[0] === 0 && stdio[1] === 1 && stdio[2] === 2 + ) { + return ["inherit", "inherit", "inherit"]; + } + // At least 3 stdio must be created to match node while (stdio.length < 3) { ArrayPrototypePush(stdio, undefined); -- cgit v1.2.3