mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Insert proxy settings for npx as well
This commit is contained in:
parent
3ef4ed8bad
commit
ea383a18de
1 changed files with 8 additions and 5 deletions
|
|
@ -1,10 +1,14 @@
|
||||||
import { execSync } from "child_process";
|
|
||||||
import { ui } from "../../environment/userInteraction.js";
|
import { ui } from "../../environment/userInteraction.js";
|
||||||
|
import { safeSpawn } from "../../utils/safeSpawn.js";
|
||||||
|
import { mergeSafeChainProxyEnvironmentVariables } from "../../registryProxy/registryProxy.js";
|
||||||
|
|
||||||
export function runNpx(args) {
|
export async function runNpx(args) {
|
||||||
try {
|
try {
|
||||||
const npxCommand = `npx ${args.join(" ")}`;
|
const result = await safeSpawn("npx", args, {
|
||||||
execSync(npxCommand, { stdio: "inherit" });
|
stdio: "inherit",
|
||||||
|
env: mergeSafeChainProxyEnvironmentVariables(process.env),
|
||||||
|
});
|
||||||
|
return { status: result.status };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.status) {
|
if (error.status) {
|
||||||
return { status: error.status };
|
return { status: error.status };
|
||||||
|
|
@ -13,5 +17,4 @@ export function runNpx(args) {
|
||||||
return { status: 1 };
|
return { status: 1 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return { status: 0 };
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue