Unable to resolve your shell pops-up instantly (fix #136272)

This commit is contained in:
Benjamin Pasero
2021-11-03 08:38:59 +01:00
parent af261488f8
commit 02d4cb5383

View File

@@ -282,7 +282,7 @@ export class CodeApplication extends Disposable {
}
// Resolve shell env
return this.resolveShellEnvironment(args, env);
return this.resolveShellEnvironment(args, env, false);
});
ipcMain.handle('vscode:writeNlsFile', (event, path: unknown, data: unknown) => {
@@ -990,7 +990,7 @@ export class CodeApplication extends Disposable {
// Since this operation can take a long time, we want to warm it up while
// the window is opening.
// We also show an error to the user in case this fails.
this.resolveShellEnvironment(this.environmentMainService.args, process.env);
this.resolveShellEnvironment(this.environmentMainService.args, process.env, true);
// If enable-crash-reporter argv is undefined then this is a fresh start,
// based on telemetry.enableCrashreporter settings, generate a UUID which
@@ -1022,11 +1022,16 @@ export class CodeApplication extends Disposable {
}
}
private async resolveShellEnvironment(args: NativeParsedArgs, env: IProcessEnvironment): Promise<typeof process.env> {
private async resolveShellEnvironment(args: NativeParsedArgs, env: IProcessEnvironment, notifyOnError: boolean): Promise<typeof process.env> {
try {
return await resolveShellEnv(this.logService, args, env);
} catch (error) {
this.windowsMainService?.sendToFocused('vscode:showResolveShellEnvError', toErrorMessage(error));
const errorMessage = toErrorMessage(error);
if (notifyOnError) {
this.windowsMainService?.sendToFocused('vscode:showResolveShellEnvError', errorMessage);
} else {
this.logService.error(errorMessage);
}
}
return {};