Skip to content

Commit 7bcf20f

Browse files
committed
change to resolve
1 parent d4a28eb commit 7bcf20f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/core/src/shared/env/resolveEnv.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { asEnvironmentVariables } from '../../auth/credentials/utils'
2020
import { getIAMConnection } from '../../auth/utils'
2121
import { ChildProcess } from '../utilities/processUtils'
2222

23-
let unixShellEnvPromise: Promise<typeof process.env> | undefined = undefined
23+
let unixShellEnvPromise: Promise<typeof process.env | undefined> | undefined = undefined
2424
let envCacheExpireTime: number
2525

2626
export interface IProcessEnvironment {
@@ -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 | undefined>(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(undefined)
189189
}
190190
} catch {
191191
// failed resolve should not affect other feature.
192-
return undefined
192+
resolve(undefined)
193193
}
194194
})
195195
}

0 commit comments

Comments
 (0)