@@ -20,7 +20,7 @@ import { asEnvironmentVariables } from '../../auth/credentials/utils'
20
20
import { getIAMConnection } from '../../auth/utils'
21
21
import { ChildProcess } from '../utilities/processUtils'
22
22
23
- let unixShellEnvPromise : Promise < typeof process . env > | undefined = undefined
23
+ let unixShellEnvPromise : Promise < typeof process . env | void > | undefined = undefined
24
24
let envCacheExpireTime : number
25
25
26
26
export interface IProcessEnvironment {
@@ -139,7 +139,7 @@ export async function mergeResolvedShellPath(env: IProcessEnvironment): Promise<
139
139
* - we hit a timeout of `MAX_SHELL_RESOLVE_TIME`
140
140
* - any other error from spawning a shell to figure out the environment
141
141
*/
142
- export async function getResolvedShellEnv ( env ?: IProcessEnvironment ) : Promise < typeof process . env | undefined > {
142
+ export async function getResolvedShellEnv ( env ?: IProcessEnvironment ) : Promise < typeof process . env | void > {
143
143
if ( ! env ) {
144
144
env = process . env
145
145
}
@@ -176,7 +176,7 @@ export async function getResolvedShellEnv(env?: IProcessEnvironment): Promise<ty
176
176
if ( ! unixShellEnvPromise || Date . now ( ) > envCacheExpireTime ) {
177
177
// cache valid for 5 minutes
178
178
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 ) => {
180
180
const timeout = new Timeout ( 10000 )
181
181
182
182
// Resolve shell env and handle errors
@@ -185,11 +185,11 @@ export async function getResolvedShellEnv(env?: IProcessEnvironment): Promise<ty
185
185
if ( shellEnv && Object . keys ( shellEnv ) . length > 0 ) {
186
186
resolve ( shellEnv )
187
187
} else {
188
- return undefined
188
+ resolve ( )
189
189
}
190
190
} catch {
191
191
// failed resolve should not affect other feature.
192
- return undefined
192
+ resolve ( )
193
193
}
194
194
} )
195
195
}
0 commit comments