From 612b7dfcc76278f7823b2ea09540922955ac8bf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Fri, 10 Nov 2023 06:59:39 +0100 Subject: fix(node/child_process): properly normalize stdio for 'spawnSync' (#21103) Closes https://github.com/denoland/deno/issues/20782 --- ext/node/polyfills/internal/child_process.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'ext/node/polyfills') diff --git a/ext/node/polyfills/internal/child_process.ts b/ext/node/polyfills/internal/child_process.ts index 33b0b3166..7d707758e 100644 --- a/ext/node/polyfills/internal/child_process.ts +++ b/ext/node/polyfills/internal/child_process.ts @@ -835,7 +835,12 @@ export function spawnSync( maxBuffer, windowsVerbatimArguments = false, } = options; - const normalizedStdio = normalizeStdioOption(stdio); + const [ + _stdin_ = "pipe", // TODO(bartlomieju): use this? + stdout_ = "pipe", + stderr_ = "pipe", + _channel, // TODO(kt3k): handle this correctly + ] = normalizeStdioOption(stdio); [command, args] = buildCommand(command, args ?? [], shell); const result: SpawnSyncResult = {}; @@ -844,8 +849,8 @@ export function spawnSync( args, cwd, env: mapValues(env, (value) => value.toString()), - stdout: toDenoStdio(normalizedStdio[1]), - stderr: toDenoStdio(normalizedStdio[2]), + stdout: toDenoStdio(stdout_), + stderr: toDenoStdio(stderr_), uid, gid, windowsRawArguments: windowsVerbatimArguments, -- cgit v1.2.3