mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
fix handling of no timeout
Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>
This commit is contained in:
parent
90abfc479a
commit
9e3a05e087
@ -31,14 +31,20 @@ let shellSyncFailed = false;
|
|||||||
export async function shellEnv(shell?: string, timeout?: number) : Promise<EnvironmentVariables> {
|
export async function shellEnv(shell?: string, timeout?: number) : Promise<EnvironmentVariables> {
|
||||||
let envVars = {};
|
let envVars = {};
|
||||||
|
|
||||||
|
timeout ??= 0;
|
||||||
|
|
||||||
if (!shellSyncFailed) {
|
if (!shellSyncFailed) {
|
||||||
try {
|
try {
|
||||||
envVars = await Promise.race([
|
if (timeout > 0 ) {
|
||||||
shellEnvironment(shell),
|
envVars = await Promise.race([
|
||||||
new Promise((_resolve, reject) => setTimeout(() => {
|
shellEnvironment(shell),
|
||||||
reject(new Error("Resolving shell environment is taking very long. Please review your shell configuration."));
|
new Promise((_resolve, reject) => setTimeout(() => {
|
||||||
}, timeout))
|
reject(new Error("Resolving shell environment is taking very long. Please review your shell configuration."));
|
||||||
]);
|
}, timeout))
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
envVars = await shellEnvironment(shell);
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(`shellEnv: ${error}`);
|
logger.error(`shellEnv: ${error}`);
|
||||||
shellSyncFailed = true;
|
shellSyncFailed = true;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user