()
| 48 | export {systemProxy} |
| 49 | let inited = false; |
| 50 | export async function getSystemProxy() { |
| 51 | if (!inited) { |
| 52 | if (isMac) { |
| 53 | parseMacProxySettings(); |
| 54 | } else if (isWindows) { |
| 55 | await parseWindowsProxySettings(); |
| 56 | } |
| 57 | |
| 58 | if (systemProxy.http_proxy) { |
| 59 | process.env.GLOBAL_AGENT_HTTP_PROXY = systemProxy.http_proxy |
| 60 | } |
| 61 | |
| 62 | if (systemProxy.https_proxy) { |
| 63 | process.env.GLOBAL_AGENT_HTTPS_PROXY = systemProxy.https_proxy |
| 64 | } |
| 65 | |
| 66 | systemProxyString = JSON.stringify(systemProxy); |
| 67 | inited = true; |
| 68 | } |
| 69 | return { |
| 70 | systemProxy, |
| 71 | systemProxyString |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | function parseMacProxySettings() { |
| 76 | const systemProxyString = execSync("scutil --proxy").toString(); |
no test coverage detected