Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(appbuilder): Fix min node version test #5953

Closed
wants to merge 14 commits into from
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
Loading