Run Windows npm.cmd via shell in native bundle build
This commit is contained in:
@@ -21,10 +21,22 @@ function resolveCommand(command) {
|
|||||||
return 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 = {}) {
|
function run(command, args, options = {}) {
|
||||||
const resolvedCommand = resolveCommand(command);
|
const resolvedCommand = resolveCommand(command);
|
||||||
const result = spawnSync(resolvedCommand, args, {
|
const result = spawnSync(resolvedCommand, args, {
|
||||||
stdio: "inherit",
|
stdio: "inherit",
|
||||||
|
...spawnOptions(resolvedCommand, options),
|
||||||
...options,
|
...options,
|
||||||
});
|
});
|
||||||
if (result.error) {
|
if (result.error) {
|
||||||
@@ -40,6 +52,7 @@ function runCapture(command, args, options = {}) {
|
|||||||
const result = spawnSync(resolvedCommand, args, {
|
const result = spawnSync(resolvedCommand, args, {
|
||||||
encoding: "utf8",
|
encoding: "utf8",
|
||||||
stdio: ["ignore", "pipe", "pipe"],
|
stdio: ["ignore", "pipe", "pipe"],
|
||||||
|
...spawnOptions(resolvedCommand, options),
|
||||||
...options,
|
...options,
|
||||||
});
|
});
|
||||||
if (result.error) {
|
if (result.error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user