Skip to content

Commit 2918d27

Browse files
committed
add option to unset proxy env vars
1 parent 6d05225 commit 2918d27

File tree

6 files changed

+34
-130
lines changed

6 files changed

+34
-130
lines changed

lib/connection/local.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ junorc = client.import 'junorc', false
66

77
cycler = require './process/cycler'
88
ssh = require './process/remote'
9-
basic = require './process/basic2'
9+
basic = require './process/basic'
1010

1111
module.exports =
1212
consumeGetServerConfig: (getconf) ->

lib/connection/process/basic.coffee

Lines changed: 0 additions & 120 deletions
This file was deleted.

lib/connection/process/basic2.js renamed to lib/connection/process/basic.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,32 @@ export function get (path, args) {
1919
}
2020

2121
export function get_ (path, args) {
22+
const env = customEnv()
23+
if (process.platform == 'win32') {
24+
return getWindows(path, args, env)
25+
} else {
26+
return getUnix(path, args, env)
27+
}
28+
}
29+
30+
export function customEnv (env = process.env) {
2231
let confnt = atom.config.get('julia-client.juliaOptions.numberOfThreads')
2332
let confntInt = parseInt(confnt)
2433

2534
if (confnt == 'auto') {
26-
process.env.JULIA_NUM_THREADS = require('physical-cpu-count')
35+
env.JULIA_NUM_THREADS = require('physical-cpu-count')
2736
} else if (confntInt != 0 && isFinite(confntInt)) {
28-
process.env.JULIA_NUM_THREADS = confntInt
37+
env.JULIA_NUM_THREADS = confntInt
2938
}
3039

31-
if (process.platform == 'win32') {
32-
return getWindows(path, args, process.env)
33-
} else {
34-
return getUnix(path, args, process.env)
40+
if (atom.config.get('julia-client.disableProxy')) {
41+
delete env.HTTP_PROXY
42+
delete env.HTTPS_PROXY
43+
delete env.http_proxy
44+
delete env.https_proxy
3545
}
46+
47+
return env
3648
}
3749

3850
// TODO: reduce code duplication in getUnix and getWindows

lib/connection/process/cycler.coffee

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{isEqual} = require 'underscore-plus'
2-
basic2 = require './basic2'
2+
basic = require './basic'
33

44
IPC = require '../ipc'
55

66
module.exports =
77
provider: ->
8-
basic2
8+
basic
99

1010
cacheLength: 1
1111

lib/package/config.coffee

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,15 @@ config =
510510
type: 'array'
511511
default: ['source.julia', 'source.weave.md', 'source.weave.latex']
512512
order: 6
513+
disableProxy:
514+
title: 'Disable System Proxy for Child Processes'
515+
description:
516+
'This unsets the `HTTP_PROXY` and `HTTPS_PROXY` environment variables in all integrated
517+
terminals. Try this option if you\'re experiencing issues when installing Julia packages
518+
in Juno.'
519+
type: 'boolean'
520+
default: false
521+
order: 7
513522

514523
firstBoot:
515524
type: 'boolean'

lib/runtime/console.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use babel'
22

33
import { client } from '../connection'
4+
import { customEnv } from '../connection/process/basic'
45
import { CompositeDisposable } from 'atom'
56
import { paths } from '../misc'
67
import modules from './modules'
@@ -308,11 +309,13 @@ function shellPty (cwd) {
308309
})
309310
cwd = paths.home()
310311
}
312+
env = customEnv()
311313
resolve({
312314
pty: pty.fork(atom.config.get("julia-client.consoleOptions.shell"), [], {
313315
cols: 100,
314316
rows: 30,
315-
cwd: cwd
317+
cwd: cwd,
318+
env: env
316319
}),
317320
cwd: cwd})
318321
} else {

0 commit comments

Comments
 (0)