From 5bf7d6b666bba438ef9264befe63d0d88350dbc9 Mon Sep 17 00:00:00 2001 From: Advait Paliwal Date: Tue, 24 Mar 2026 12:48:35 -0700 Subject: [PATCH] Run Windows npm.cmd via shell in native bundle build --- scripts/build-native-bundle.mjs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/build-native-bundle.mjs b/scripts/build-native-bundle.mjs index 93948f0..e743143 100644 --- a/scripts/build-native-bundle.mjs +++ b/scripts/build-native-bundle.mjs @@ -21,10 +21,22 @@ function resolveCommand(command) { return command; } +function spawnOptions(command, options = {}) { + if (process.platform === "win32" && command.endsWith(".cmd")) { + return { + shell: true, + ...options, + }; + } + + return options; +} + function run(command, args, options = {}) { const resolvedCommand = resolveCommand(command); const result = spawnSync(resolvedCommand, args, { stdio: "inherit", + ...spawnOptions(resolvedCommand, options), ...options, }); if (result.error) { @@ -40,6 +52,7 @@ function runCapture(command, args, options = {}) { const result = spawnSync(resolvedCommand, args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], + ...spawnOptions(resolvedCommand, options), ...options, }); if (result.error) {