mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 20:20:49 +00:00
Adapt per review
This commit is contained in:
parent
9dacf5cff3
commit
190607de92
27 changed files with 191 additions and 114 deletions
|
|
@ -19,34 +19,3 @@ export async function runPip(command, args) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function dryRunPipCommandAndOutput(command, args) {
|
||||
try {
|
||||
// Note: pip supports --dry-run for the "install" command only; "download" and "wheel" do not.
|
||||
// We don't mutate args here — callers should include --dry-run when appropriate.
|
||||
const result = await safeSpawnPy(
|
||||
command,
|
||||
args,
|
||||
{
|
||||
stdio: "pipe",
|
||||
env: mergeSafeChainProxyEnvironmentVariables(process.env),
|
||||
}
|
||||
);
|
||||
return {
|
||||
status: result.status,
|
||||
output: result.status === 0 ? result.stdout : result.stderr,
|
||||
};
|
||||
} catch (error) {
|
||||
if (error.status) {
|
||||
const output =
|
||||
error.stdout?.toString() ??
|
||||
error.stderr?.toString() ??
|
||||
error.message ??
|
||||
"";
|
||||
return { status: error.status, output };
|
||||
} else {
|
||||
ui.writeError("Error executing command:", error.message);
|
||||
return { status: 1 };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue