mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Remove the unecessary proxy setting
This commit is contained in:
parent
28132ba3fc
commit
7ce44b4c62
2 changed files with 1 additions and 22 deletions
|
|
@ -9,13 +9,9 @@ import { reportCommandExecutionFailure } from "../_shared/commandErrors.js";
|
||||||
*/
|
*/
|
||||||
export async function runRushCommand(executableName, args) {
|
export async function runRushCommand(executableName, args) {
|
||||||
try {
|
try {
|
||||||
const env = prepareRushEnvironmentVariables(
|
|
||||||
mergeSafeChainProxyEnvironmentVariables(process.env),
|
|
||||||
);
|
|
||||||
|
|
||||||
const result = await safeSpawn(executableName, args, {
|
const result = await safeSpawn(executableName, args, {
|
||||||
stdio: "inherit",
|
stdio: "inherit",
|
||||||
env,
|
env: mergeSafeChainProxyEnvironmentVariables(process.env),
|
||||||
});
|
});
|
||||||
|
|
||||||
return { status: result.status };
|
return { status: result.status };
|
||||||
|
|
@ -23,19 +19,3 @@ export async function runRushCommand(executableName, args) {
|
||||||
return reportCommandExecutionFailure(error, executableName);
|
return reportCommandExecutionFailure(error, executableName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Record<string, string>} env
|
|
||||||
* @returns {Record<string, string>}
|
|
||||||
*/
|
|
||||||
function prepareRushEnvironmentVariables(env) {
|
|
||||||
const prepared = {
|
|
||||||
...env,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (prepared.HTTPS_PROXY && !prepared.HTTP_PROXY) {
|
|
||||||
prepared.HTTP_PROXY = prepared.HTTPS_PROXY;
|
|
||||||
}
|
|
||||||
|
|
||||||
return prepared;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,6 @@ describe("runRushCommand", () => {
|
||||||
assert.deepStrictEqual(args, ["install"]);
|
assert.deepStrictEqual(args, ["install"]);
|
||||||
assert.strictEqual(options.stdio, "inherit");
|
assert.strictEqual(options.stdio, "inherit");
|
||||||
assert.strictEqual(options.env.HTTPS_PROXY, "http://localhost:8080");
|
assert.strictEqual(options.env.HTTPS_PROXY, "http://localhost:8080");
|
||||||
assert.strictEqual(options.env.HTTP_PROXY, "http://localhost:8080");
|
|
||||||
assert.ok(mergeCalls.length >= 1, "proxy env merge should be called");
|
assert.ok(mergeCalls.length >= 1, "proxy env merge should be called");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue