Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Add support for reading http.proxy setting (#639)
Browse files Browse the repository at this point in the history
* Add support for reading http.proxy setting

* fix proxy config

1. set both lower and upper case proxy environment variable
2. do not touch process.env when http.proxy setting is not present
  • Loading branch information
ibigbug authored and ramya-rao-a committed Dec 30, 2016
1 parent 7ea8bb1 commit bcb1e2a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/goInstallTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,20 @@ function installTools(goVersion: SemVersion, missing?: string[]) {

outputChannel.appendLine(''); // Blank line for spacing.

// http.proxy setting takes precedence over environment variables
let httpProxy = vscode.workspace.getConfiguration('http').get('proxy');
let env = process.env;
if (httpProxy) {
env = Object.assign({}, process.env, {
http_proxy: httpProxy,
HTTP_PROXY: httpProxy,
https_proxy: httpProxy,
HTTPS_PROXY: httpProxy,
});
}
missing.reduce((res: Promise<string[]>, tool: string) => {
return res.then(sofar => new Promise<string[]>((resolve, reject) => {
cp.execFile(goRuntimePath, ['get', '-u', '-v', tools[tool]], { env: process.env }, (err, stdout, stderr) => {
cp.execFile(goRuntimePath, ['get', '-u', '-v', tools[tool]], { env }, (err, stdout, stderr) => {
if (err) {
outputChannel.appendLine('Installing ' + tool + ' FAILED');
let failureReason = tool + ';;' + err + stdout.toString() + stderr.toString();
Expand Down

0 comments on commit bcb1e2a

Please sign in to comment.