提交 c82ac047 编写于 作者: D Daniel Imms

Reland: Disable welcome page when user is root

Ideally this is a temporary fix for gettingStarted and can be removed once the
freeze is fixed in electron.

Fixes #3068
Fixes #5067
上级 3e16b9bc
......@@ -9,6 +9,7 @@
let _isWindows = false;
let _isMacintosh = false;
let _isLinux = false;
let _isRootUser = false;
let _isNative = false;
let _isWeb = false;
let _isQunit = false;
......@@ -23,6 +24,7 @@ interface NLSConfig {
interface INodeProcess {
platform: string;
env: { [key: string]: string; };
getuid(): number;
}
declare let process: INodeProcess;
declare let global: any;
......@@ -39,6 +41,7 @@ if (typeof process === 'object') {
_isWindows = (process.platform === 'win32');
_isMacintosh = (process.platform === 'darwin');
_isLinux = (process.platform === 'linux');
_isRootUser = !_isWindows && (process.getuid() === 0);
let vscode_nls_config = process.env['VSCODE_NLS_CONFIG'];
if (vscode_nls_config) {
try {
......@@ -83,6 +86,7 @@ if (_isNative) {
export const isWindows = _isWindows;
export const isMacintosh = _isMacintosh;
export const isLinux = _isLinux;
export const isRootUser = _isRootUser;
export const isNative = _isNative;
export const isWeb = _isWeb;
export const isQunit = _isQunit;
......
......@@ -6,12 +6,18 @@
import {IWorkbenchContribution} from 'vs/workbench/common/contributions';
import {AbstractGettingStarted} from 'vs/workbench/parts/gettingStarted/common/abstractGettingStarted';
import * as platform from 'vs/base/common/platform';
import { shell } from 'electron';
export class ElectronGettingStarted extends AbstractGettingStarted implements IWorkbenchContribution {
protected openExternal(url: string) {
// Don't open the welcome page as the root user on Linux, this is due to a bug with xdg-open
// which recommends against running itself as root.
if (platform.isLinux && platform.isRootUser) {
return;
}
shell.openExternal(url);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册