@@ -20,7 +20,7 @@ import { asEnvironmentVariables } from '../../auth/credentials/utils'
2020import { getIAMConnection } from '../../auth/utils'
2121import { ChildProcess } from '../utilities/processUtils'
2222
23- let unixShellEnvPromise : Promise < typeof process . env > | undefined = undefined
23+ let unixShellEnvPromise : Promise < typeof process . env | void > | undefined = undefined
2424let envCacheExpireTime : number
2525
2626export interface IProcessEnvironment {
@@ -139,7 +139,7 @@ export async function mergeResolvedShellPath(env: IProcessEnvironment): Promise<
139139 * - we hit a timeout of `MAX_SHELL_RESOLVE_TIME`
140140 * - any other error from spawning a shell to figure out the environment
141141 */
142- export async function getResolvedShellEnv ( env ?: IProcessEnvironment ) : Promise < typeof process . env | undefined > {
142+ export async function getResolvedShellEnv ( env ?: IProcessEnvironment ) : Promise < typeof process . env | void > {
143143 if ( ! env ) {
144144 env = process . env
145145 }
@@ -176,7 +176,7 @@ export async function getResolvedShellEnv(env?: IProcessEnvironment): Promise<ty
176176 if ( ! unixShellEnvPromise || Date . now ( ) > envCacheExpireTime ) {
177177 // cache valid for 5 minutes
178178 envCacheExpireTime = Date . now ( ) + 5 * 60 * 1000
179- unixShellEnvPromise = new Promise < NodeJS . ProcessEnv > ( async ( resolve , reject ) => {
179+ unixShellEnvPromise = new Promise < NodeJS . ProcessEnv | void > ( async ( resolve , reject ) => {
180180 const timeout = new Timeout ( 10000 )
181181
182182 // Resolve shell env and handle errors
@@ -185,11 +185,11 @@ export async function getResolvedShellEnv(env?: IProcessEnvironment): Promise<ty
185185 if ( shellEnv && Object . keys ( shellEnv ) . length > 0 ) {
186186 resolve ( shellEnv )
187187 } else {
188- return undefined
188+ resolve ( )
189189 }
190190 } catch {
191191 // failed resolve should not affect other feature.
192- return undefined
192+ resolve ( )
193193 }
194194 } )
195195 }
0 commit comments