Use proxy-agent to support $HTTP_PROXY

Closes #124

This works by monkey patching the http and https modules's default agent
at runtime to the one given by the proxy-agent package.
This commit is contained in:
Anmol Sethi
2020-12-04 00:53:27 -05:00
parent cee88ad637
commit 691d44d4a8
5 changed files with 845 additions and 17 deletions

View File

@ -20,6 +20,7 @@ import { commit, version } from "./constants"
import { register } from "./routes"
import { humanPath, isFile, open } from "./util"
import { isChild, wrapper } from "./wrapper"
import * as proxyAgent from "./proxy_agent"
export const runVsCodeCli = (args: DefaultedArgs): void => {
logger.debug("forking vs code cli...")
@ -154,6 +155,8 @@ const main = async (args: DefaultedArgs): Promise<void> => {
}
async function entry(): Promise<void> {
proxyAgent.monkeyPatch(false)
// There's no need to check flags like --help or to spawn in an existing
// instance for the child process because these would have already happened in
// the parent and the child wouldn't have been spawned. We also get the