Skip to content

Commit b60faaa

Browse files
author
Benjamin Pasero
committed
fix microsoft#74321 (revert back from async/await due to minifier issues)
1 parent 3177785 commit b60faaa

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

src/vs/workbench/electron-browser/window.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -314,21 +314,24 @@ export class ElectronWindow extends Disposable {
314314
this.integrityService.isPure().then(res => this.titleService.updateProperties({ isPure: res.isPure }));
315315

316316
// Root warning
317-
this.lifecycleService.when(LifecyclePhase.Restored).then(async () => {
318-
let isAdmin: boolean;
317+
this.lifecycleService.when(LifecyclePhase.Restored).then(() => {
318+
let isAdminPromise: Promise<boolean>;
319319
if (isWindows) {
320-
isAdmin = (await import('native-is-elevated'))();
320+
isAdminPromise = import('native-is-elevated').then(isElevated => isElevated()); // not using async here due to https://github.com/microsoft/vscode/issues/74321
321321
} else {
322-
isAdmin = isRootUser();
322+
isAdminPromise = Promise.resolve(isRootUser());
323323
}
324324

325-
// Update title
326-
this.titleService.updateProperties({ isAdmin });
325+
return isAdminPromise.then(isAdmin => {
327326

328-
// Show warning message (unix only)
329-
if (isAdmin && !isWindows) {
330-
this.notificationService.warn(nls.localize('runningAsRoot', "It is not recommended to run {0} as root user.", product.nameShort));
331-
}
327+
// Update title
328+
this.titleService.updateProperties({ isAdmin });
329+
330+
// Show warning message (unix only)
331+
if (isAdmin && !isWindows) {
332+
this.notificationService.warn(nls.localize('runningAsRoot', "It is not recommended to run {0} as root user.", product.nameShort));
333+
}
334+
});
332335
});
333336

334337
// Touchbar menu (if enabled)

0 commit comments

Comments
 (0)