@@ -115,10 +115,15 @@ export function execPythonFile(file: string, args: string[], cwd: string, includ
115115 return getPythonInterpreterDirectory ( ) . then ( pyPath => {
116116 // We don't have a path
117117 if ( pyPath . length === 0 ) {
118+ let options : child_process . ExecFileOptions = { cwd } ;
119+ const envVars = customEnvVariables || getCustomEnvVars ( ) ;
120+ if ( envVars ) {
121+ options . env = envVars ;
122+ }
118123 if ( stdOut ) {
119- return spawnFileInternal ( file , args , { cwd } , includeErrorAsResponse , stdOut , token ) ;
124+ return spawnFileInternal ( file , args , options , includeErrorAsResponse , stdOut , token ) ;
120125 }
121- return execFileInternal ( file , args , { cwd : cwd } , includeErrorAsResponse , token ) ;
126+ return execFileInternal ( file , args , options , includeErrorAsResponse , token ) ;
122127 }
123128
124129 if ( customEnvVariables === null ) {
@@ -144,7 +149,7 @@ export function execPythonFile(file: string, args: string[], cwd: string, includ
144149 }
145150 if ( execAsModule ) {
146151 return getFullyQualifiedPythonInterpreterPath ( )
147- . then ( p => execPythonModule ( p , args , { cwd : cwd } , includeErrorAsResponse , token ) ) ;
152+ . then ( p => execPythonModule ( p , args , { cwd : cwd , env : customEnvVariables } , includeErrorAsResponse , token ) ) ;
148153 }
149154 return execFileInternal ( file , args , { cwd, env : customEnvVariables } , includeErrorAsResponse , token ) ;
150155 } ) ;
0 commit comments