debt - some more process and platform 💄
This commit is contained in:
parent
892a1083cb
commit
a7f5a10158
6
src/bootstrap-fork.js
vendored
6
src/bootstrap-fork.js
vendored
|
@ -49,7 +49,11 @@ require('./bootstrap-amd').load(process.env['VSCODE_AMD_ENTRYPOINT']);
|
|||
function pipeLoggingToParent() {
|
||||
const MAX_LENGTH = 100000;
|
||||
|
||||
// Prevent circular stringify and convert arguments to real array
|
||||
/**
|
||||
* Prevent circular stringify and convert arguments to real array
|
||||
*
|
||||
* @param {IArguments} args
|
||||
*/
|
||||
function safeToArray(args) {
|
||||
const seen = [];
|
||||
const argsArray = [];
|
||||
|
|
1
src/bootstrap-node.js
vendored
1
src/bootstrap-node.js
vendored
|
@ -10,6 +10,7 @@
|
|||
// - Windows: call `process.chdir()` to always set application folder as cwd
|
||||
// - Posix: allow to change the current working dir via `VSCODE_CWD` if defined
|
||||
// - all OS: store the `process.cwd()` inside `VSCODE_CWD` for consistent lookups
|
||||
// // TODO@bpasero revisit if chdir() on Windows is needed in the future still
|
||||
function setupCurrentWorkingDirectory() {
|
||||
const path = require('path');
|
||||
|
||||
|
|
|
@ -487,7 +487,7 @@ function getNodeCachedDir() {
|
|||
return new class {
|
||||
|
||||
constructor() {
|
||||
this.value = this._compute();
|
||||
this.value = this.compute();
|
||||
}
|
||||
|
||||
async ensureExists() {
|
||||
|
@ -502,7 +502,7 @@ function getNodeCachedDir() {
|
|||
}
|
||||
}
|
||||
|
||||
_compute() {
|
||||
compute() {
|
||||
if (process.argv.indexOf('--no-cached-data') > 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,13 @@ export interface IProcessEnvironment {
|
|||
[key: string]: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* This interface is intentionally not identical to node.js
|
||||
* process because it also works in sandboxed environments
|
||||
* where the process object is implemented differently. We
|
||||
* define the properties here that we need for `platform`
|
||||
* to work and nothing else.
|
||||
*/
|
||||
export interface INodeProcess {
|
||||
platform: string;
|
||||
env: IProcessEnvironment;
|
||||
|
@ -38,26 +45,20 @@ export interface INodeProcess {
|
|||
type?: string;
|
||||
cwd: () => string;
|
||||
}
|
||||
|
||||
declare const process: INodeProcess;
|
||||
declare const global: any;
|
||||
declare const global: unknown;
|
||||
declare const self: unknown;
|
||||
|
||||
interface INavigator {
|
||||
userAgent: string;
|
||||
language: string;
|
||||
maxTouchPoints?: number;
|
||||
}
|
||||
declare const navigator: INavigator;
|
||||
declare const self: any;
|
||||
|
||||
const _globals = (typeof self === 'object' ? self : typeof global === 'object' ? global : {} as any);
|
||||
export const globals: any = (typeof self === 'object' ? self : typeof global === 'object' ? global : {});
|
||||
|
||||
let nodeProcess: INodeProcess | undefined = undefined;
|
||||
if (typeof process !== 'undefined') {
|
||||
// Native environment (non-sandboxed)
|
||||
nodeProcess = process;
|
||||
} else if (typeof _globals.vscode !== 'undefined') {
|
||||
} else if (typeof globals.vscode !== 'undefined') {
|
||||
// Native environment (sandboxed)
|
||||
nodeProcess = _globals.vscode.process;
|
||||
nodeProcess = globals.vscode.process;
|
||||
}
|
||||
|
||||
const isElectronRenderer = typeof nodeProcess?.versions?.electron === 'string' && nodeProcess.type === 'renderer';
|
||||
|
@ -83,6 +84,13 @@ export const browserCodeLoadingCacheStrategy: 'none' | 'code' | 'bypassHeatCheck
|
|||
})();
|
||||
export const isPreferringBrowserCodeLoad = typeof browserCodeLoadingCacheStrategy === 'string';
|
||||
|
||||
interface INavigator {
|
||||
userAgent: string;
|
||||
language: string;
|
||||
maxTouchPoints?: number;
|
||||
}
|
||||
declare const navigator: INavigator;
|
||||
|
||||
// Web environment
|
||||
if (typeof navigator === 'object' && !isElectronRenderer) {
|
||||
_userAgent = navigator.userAgent;
|
||||
|
@ -197,10 +205,8 @@ export const locale = _locale;
|
|||
*/
|
||||
export const translationsConfigFile = _translationsConfigFile;
|
||||
|
||||
export const globals: any = _globals;
|
||||
|
||||
interface ISetImmediate {
|
||||
(callback: (...args: any[]) => void): void;
|
||||
(callback: (...args: unknown[]) => void): void;
|
||||
}
|
||||
|
||||
export const setImmediate: ISetImmediate = (function defineSetImmediate() {
|
||||
|
@ -239,7 +245,7 @@ export const setImmediate: ISetImmediate = (function defineSetImmediate() {
|
|||
return nodeProcess.nextTick.bind(nodeProcess);
|
||||
}
|
||||
const _promise = Promise.resolve();
|
||||
return (callback: (...args: any[]) => void) => _promise.then(callback);
|
||||
return (callback: (...args: unknown[]) => void) => _promise.then(callback);
|
||||
})();
|
||||
|
||||
export const enum OperatingSystem {
|
||||
|
|
|
@ -45,7 +45,7 @@ function getSystemShellUnixLike(p: platform.Platform, env: platform.IProcessEnvi
|
|||
}
|
||||
|
||||
if (!_TERMINAL_DEFAULT_SHELL_UNIX_LIKE) {
|
||||
let unixLikeTerminal: string;
|
||||
let unixLikeTerminal: string | undefined;
|
||||
if (platform.isWindows) {
|
||||
unixLikeTerminal = '/bin/bash'; // for WSL
|
||||
} else {
|
||||
|
|
|
@ -7,7 +7,7 @@ import { URI } from 'vs/base/common/uri';
|
|||
import { basename, join, } from 'vs/base/common/path';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { INativeEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { process } from 'vs/base/parts/sandbox/electron-sandbox/globals';
|
||||
import { env } from 'vs/base/common/process';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { isWindows } from 'vs/base/common/platform';
|
||||
import { isNonEmptyArray } from 'vs/base/common/arrays';
|
||||
|
@ -294,11 +294,11 @@ export class ExtensionTipsService extends BaseExtensionTipsService {
|
|||
const exePaths: string[] = [];
|
||||
if (isWindows) {
|
||||
if (extensionTip.windowsPath) {
|
||||
exePaths.push(extensionTip.windowsPath.replace('%USERPROFILE%', process.env['USERPROFILE']!)
|
||||
.replace('%ProgramFiles(x86)%', process.env['ProgramFiles(x86)']!)
|
||||
.replace('%ProgramFiles%', process.env['ProgramFiles']!)
|
||||
.replace('%APPDATA%', process.env['APPDATA']!)
|
||||
.replace('%WINDIR%', process.env['WINDIR']!));
|
||||
exePaths.push(extensionTip.windowsPath.replace('%USERPROFILE%', env['USERPROFILE']!)
|
||||
.replace('%ProgramFiles(x86)%', env['ProgramFiles(x86)']!)
|
||||
.replace('%ProgramFiles%', env['ProgramFiles']!)
|
||||
.replace('%APPDATA%', env['APPDATA']!)
|
||||
.replace('%WINDIR%', env['WINDIR']!));
|
||||
}
|
||||
} else {
|
||||
exePaths.push(join('/usr/local/bin', exeName));
|
||||
|
|
|
@ -20,7 +20,8 @@ import { applyZoom } from 'vs/platform/windows/electron-sandbox/window';
|
|||
import { setFullscreen, getZoomLevel } from 'vs/base/browser/browser';
|
||||
import { ICommandService, CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||
import { IResourceEditorInput } from 'vs/platform/editor/common/editor';
|
||||
import { ipcRenderer, process } from 'vs/base/parts/sandbox/electron-sandbox/globals';
|
||||
import { ipcRenderer } from 'vs/base/parts/sandbox/electron-sandbox/globals';
|
||||
import { env } from 'vs/base/common/process';
|
||||
import { IWorkspaceEditingService } from 'vs/workbench/services/workspaces/common/workspaceEditing';
|
||||
import { IMenuService, MenuId, IMenu, MenuItemAction, ICommandAction, MenuRegistry } from 'vs/platform/actions/common/actions';
|
||||
import { createAndFillInActionBarActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
|
||||
|
@ -486,7 +487,7 @@ export class NativeWindow extends Disposable {
|
|||
|
||||
// Check for cyclic dependencies
|
||||
if (require.hasDependencyCycle()) {
|
||||
if (process.env['CI'] || process.env['BUILD_ARTIFACTSTAGINGDIRECTORY']) {
|
||||
if (env['CI'] || env['BUILD_ARTIFACTSTAGINGDIRECTORY']) {
|
||||
this.logService.error('Error: There is a dependency cycle in the AMD modules that needs to be resolved!');
|
||||
this.nativeHostService.exit(37); // running on a build machine, just exit without showing a dialog
|
||||
} else {
|
||||
|
|
|
@ -11,9 +11,8 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
|
|||
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
|
||||
import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { IProcessEnvironment } from 'vs/base/common/platform';
|
||||
import { BaseConfigurationResolverService } from 'vs/workbench/services/configurationResolver/browser/configurationResolverService';
|
||||
import { process } from 'vs/base/parts/sandbox/electron-sandbox/globals';
|
||||
import { env } from 'vs/base/common/process';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
|
||||
export class ConfigurationResolverService extends BaseConfigurationResolverService {
|
||||
|
@ -34,7 +33,7 @@ export class ConfigurationResolverService extends BaseConfigurationResolverServi
|
|||
getExecPath: (): string | undefined => {
|
||||
return environmentService.execPath;
|
||||
}
|
||||
}, process.env as IProcessEnvironment, editorService, configurationService, commandService, workspaceContextService, quickInputService, labelService);
|
||||
}, env, editorService, configurationService, commandService, workspaceContextService, quickInputService, labelService);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import { getZoomLevel } from 'vs/base/browser/browser';
|
|||
import { IWorkbenchIssueService } from 'vs/workbench/services/issue/common/issue';
|
||||
import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService';
|
||||
import { ExtensionType } from 'vs/platform/extensions/common/extensions';
|
||||
import { process } from 'vs/base/parts/sandbox/electron-sandbox/globals';
|
||||
import { platform } from 'vs/base/common/process';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { ITASExperimentService } from 'vs/workbench/services/experiment/common/experimentService';
|
||||
import { IAuthenticationService } from 'vs/workbench/services/authentication/browser/authenticationService';
|
||||
|
@ -94,7 +94,7 @@ export class WorkbenchIssueService implements IWorkbenchIssueService {
|
|||
hoverBackground: getColor(theme, listHoverBackground),
|
||||
hoverForeground: getColor(theme, listHoverForeground)
|
||||
},
|
||||
platform: process.platform,
|
||||
platform: platform,
|
||||
applicationName: this.productService.applicationName
|
||||
};
|
||||
return this.issueService.openProcessExplorer(data);
|
||||
|
|
|
@ -27,9 +27,9 @@ export async function resolveWorkbenchCommonProperties(
|
|||
const lastSessionDate = storageService.get(lastSessionDateStorageKey, StorageScope.GLOBAL)!;
|
||||
|
||||
// __GDPR__COMMON__ "common.version.shell" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
|
||||
result['common.version.shell'] = process.versions && process.versions['electron'];
|
||||
result['common.version.shell'] = process.versions['electron'];
|
||||
// __GDPR__COMMON__ "common.version.renderer" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
|
||||
result['common.version.renderer'] = process.versions && process.versions['chrome'];
|
||||
result['common.version.renderer'] = process.versions['chrome'];
|
||||
// __GDPR__COMMON__ "common.firstSessionDate" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
result['common.firstSessionDate'] = firstSessionDate;
|
||||
// __GDPR__COMMON__ "common.lastSessionDate" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
|
|
Loading…
Reference in a new issue