diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2024-03-24 11:25:53 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-24 06:55:53 +0100 |
commit | ec9342f95a950ac13f57c85ef577e3bbab180e1a (patch) | |
tree | 33ee60bd9d8f24b0df268acda8a4a2ff02bb1d67 /ext/node/polyfills/internal/child_process.ts | |
parent | c940205353bd4401eecc757c7b18f12cfbdc5878 (diff) |
fix(ext/node): handle `null` in stdio array (#23048)
Fixes https://github.com/denoland/deno/issues/23045
Diffstat (limited to 'ext/node/polyfills/internal/child_process.ts')
-rw-r--r-- | ext/node/polyfills/internal/child_process.ts | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ext/node/polyfills/internal/child_process.ts b/ext/node/polyfills/internal/child_process.ts index 5a9212618..0ca2a958e 100644 --- a/ext/node/polyfills/internal/child_process.ts +++ b/ext/node/polyfills/internal/child_process.ts @@ -503,11 +503,20 @@ function normalizeStdioOption( if (Array.isArray(stdio)) { // `[0, 1, 2]` is equivalent to `"inherit"` if ( - stdio.length === 3 && stdio[0] === 0 && stdio[1] === 1 && stdio[2] === 2 + stdio.length === 3 && + (stdio[0] === 0 && stdio[1] === 1 && stdio[2] === 2) ) { return ["inherit", "inherit", "inherit"]; } + // `[null, null, null]` is equivalent to `"pipe" + if ( + stdio.length === 3 && + stdio[0] === null || stdio[1] === null || stdio[2] === null + ) { + return ["pipe", "pipe", "pipe"]; + } + // At least 3 stdio must be created to match node while (stdio.length < 3) { ArrayPrototypePush(stdio, undefined); |