mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 20:20:49 +00:00
Use execSync instead of spawnSync for pnpm.
This commit is contained in:
parent
e557887da9
commit
534aeee457
1 changed files with 9 additions and 20 deletions
|
|
@ -1,33 +1,22 @@
|
|||
import { spawnSync } from "child_process";
|
||||
import { execSync } from "child_process";
|
||||
import { ui } from "../../environment/userInteraction.js";
|
||||
|
||||
export function runPnpmCommand(args, toolName = "pnpm") {
|
||||
try {
|
||||
let result;
|
||||
|
||||
ui.writeInformation(
|
||||
`Executing ${toolName} with arguments:`,
|
||||
args.join(" ")
|
||||
);
|
||||
ui.writeInformation("----------------------------");
|
||||
|
||||
if (toolName === "pnpm") {
|
||||
result = spawnSync("pnpm", args, { stdio: "inherit" });
|
||||
execSync(`pnpm ${args.join(" ")}`, { stdio: "inherit" });
|
||||
} else if (toolName === "pnpx") {
|
||||
result = spawnSync("pnpx", args, { stdio: "inherit" });
|
||||
execSync(`pnpx ${args.join(" ")}`, { stdio: "inherit" });
|
||||
} else {
|
||||
throw new Error(`Unsupported tool name for aikido-pnpm: ${toolName}`);
|
||||
}
|
||||
|
||||
ui.writeInformation("----------------------------");
|
||||
ui.writeInformation(`${toolName} process exited with code:`, result.status);
|
||||
|
||||
if (result.status !== null) {
|
||||
return { status: result.status };
|
||||
}
|
||||
} catch (error) {
|
||||
ui.writeError("Error executing command:", error.message);
|
||||
return { status: 1 };
|
||||
if (error.status) {
|
||||
return { status: error.status };
|
||||
} else {
|
||||
ui.writeError("Error executing command:", error.message);
|
||||
return { status: 1 };
|
||||
}
|
||||
}
|
||||
return { status: 0 };
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue