Skip to content

Commit

Permalink
change to resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
roger-zhangg committed Nov 7, 2024
1 parent d4a28eb commit 7bcf20f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/core/src/shared/env/resolveEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { asEnvironmentVariables } from '../../auth/credentials/utils'
import { getIAMConnection } from '../../auth/utils'
import { ChildProcess } from '../utilities/processUtils'

let unixShellEnvPromise: Promise<typeof process.env> | undefined = undefined
let unixShellEnvPromise: Promise<typeof process.env | undefined> | undefined = undefined
let envCacheExpireTime: number

export interface IProcessEnvironment {
Expand Down Expand Up @@ -176,7 +176,7 @@ export async function getResolvedShellEnv(env?: IProcessEnvironment): Promise<ty
if (!unixShellEnvPromise || Date.now() > envCacheExpireTime) {
// cache valid for 5 minutes
envCacheExpireTime = Date.now() + 5 * 60 * 1000
unixShellEnvPromise = new Promise<NodeJS.ProcessEnv>(async (resolve, reject) => {
unixShellEnvPromise = new Promise<NodeJS.ProcessEnv | undefined>(async (resolve, reject) => {
const timeout = new Timeout(10000)

// Resolve shell env and handle errors
Expand All @@ -185,11 +185,11 @@ export async function getResolvedShellEnv(env?: IProcessEnvironment): Promise<ty
if (shellEnv && Object.keys(shellEnv).length > 0) {
resolve(shellEnv)
} else {
return undefined
resolve(undefined)
}
} catch {
// failed resolve should not affect other feature.
return undefined
resolve(undefined)
}
})
}
Expand Down

0 comments on commit 7bcf20f

Please sign in to comment.