From 534aeee457e06096dc36b4fa97d67a2ff4fe53a5 Mon Sep 17 00:00:00 2001 From: Sander Declerck Date: Tue, 23 Sep 2025 14:32:20 +0200 Subject: [PATCH] Use execSync instead of spawnSync for pnpm. --- .../src/packagemanager/pnpm/runPnpmCommand.js | 29 ++++++------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/packages/safe-chain/src/packagemanager/pnpm/runPnpmCommand.js b/packages/safe-chain/src/packagemanager/pnpm/runPnpmCommand.js index 50064e1..5683a62 100644 --- a/packages/safe-chain/src/packagemanager/pnpm/runPnpmCommand.js +++ b/packages/safe-chain/src/packagemanager/pnpm/runPnpmCommand.js @@ -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 }; }