Skip to content

Commit

Permalink
fix #74321 (revert back from async/await due to minifier issues)
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero committed May 29, 2019
1 parent 3177785 commit b60faaa
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/vs/workbench/electron-browser/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,21 +314,24 @@ export class ElectronWindow extends Disposable {
this.integrityService.isPure().then(res => this.titleService.updateProperties({ isPure: res.isPure }));

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

// Update title
this.titleService.updateProperties({ isAdmin });
return isAdminPromise.then(isAdmin => {

// Show warning message (unix only)
if (isAdmin && !isWindows) {
this.notificationService.warn(nls.localize('runningAsRoot', "It is not recommended to run {0} as root user.", product.nameShort));
}
// Update title
this.titleService.updateProperties({ isAdmin });

// Show warning message (unix only)
if (isAdmin && !isWindows) {
this.notificationService.warn(nls.localize('runningAsRoot', "It is not recommended to run {0} as root user.", product.nameShort));
}
});
});

// Touchbar menu (if enabled)
Expand Down

0 comments on commit b60faaa

Please sign in to comment.