Run Windows npm.cmd via shell in native bundle build

This commit is contained in:
Advait Paliwal
2026-03-24 12:48:35 -07:00
parent 785d5fa89a
commit 5bf7d6b666

View File

@@ -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) {