File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -7,13 +7,29 @@ interface ProcessOptions {
7
7
}
8
8
9
9
function makeSpawnOptions ( options ?: ProcessOptions ) {
10
- const spawnOptions : SpawnOptions = { shell : true } ;
10
+ const spawnOptions : SpawnOptions = {
11
+ shell : true ,
12
+ env : { ...process . env } ,
13
+ } ;
11
14
if ( options && options . cwd ) {
12
15
spawnOptions . cwd = options . cwd ;
13
16
}
14
17
if ( options && options . env ) {
15
18
spawnOptions . env = options . env ;
16
19
}
20
+
21
+ // Before spawning an external process, we look if we need to restore the system proxy configuration,
22
+ // which overides the cli internal proxy configuration.
23
+ if ( process . env . SNYK_SYSTEM_HTTP_PROXY !== undefined ) {
24
+ spawnOptions . env . HTTP_PROXY = process . env . SNYK_SYSTEM_HTTP_PROXY ;
25
+ }
26
+ if ( process . env . SNYK_SYSTEM_HTTPS_PROXY !== undefined ) {
27
+ spawnOptions . env . HTTPS_PROXY = process . env . SNYK_SYSTEM_HTTPS_PROXY ;
28
+ }
29
+ if ( process . env . SNYK_SYSTEM_NO_PROXY !== undefined ) {
30
+ spawnOptions . env . NO_PROXY = process . env . SNYK_SYSTEM_NO_PROXY ;
31
+ }
32
+
17
33
return spawnOptions ;
18
34
}
19
35
You can’t perform that action at this time.
0 commit comments