Merge remote-tracking branch 'origin/master' into runtime-extensions

This commit is contained in:
Alex Dima
2017-11-30 16:13:53 +01:00
86 changed files with 1890 additions and 892 deletions

View File

@@ -22,9 +22,11 @@ import * as errors from 'vs/base/common/errors';
import * as watchdog from 'native-watchdog';
import * as glob from 'vs/base/common/glob';
import { ExtensionActivatedByEvent } from 'vs/workbench/api/node/extHostExtensionActivator';
import { EnvironmentService } from 'vs/platform/environment/node/environmentService';
import { SpdLogService } from 'vs/platform/log/node/spdlogService';
// const nativeExit = process.exit.bind(process);
function patchExit(allowExit: boolean) {
function patchProcess(allowExit: boolean) {
process.exit = function (code) {
if (allowExit) {
exit(code);
@@ -33,6 +35,11 @@ function patchExit(allowExit: boolean) {
console.warn(err.stack);
}
};
process.crash = function () {
const err = new Error('An extension called process.crash() and this was prevented.');
console.warn(err.stack);
};
}
export function exit(code?: number) {
//nativeExit(code);
@@ -74,13 +81,16 @@ export class ExtensionHostMain {
this._workspace = initData.workspace;
const allowExit = !!this._environment.extensionTestsPath; // to support other test frameworks like Jasmin that use process.exit (https://github.com/Microsoft/vscode/issues/37708)
patchExit(allowExit);
patchProcess(allowExit);
// services
const threadService = new ExtHostThreadService(rpcProtocol);
const extHostWorkspace = new ExtHostWorkspace(threadService, initData.workspace);
const environmentService = new EnvironmentService(initData.args, initData.execPath);
const logService = new SpdLogService('exthost', environmentService);
this._extHostConfiguration = new ExtHostConfiguration(threadService.get(MainContext.MainThreadConfiguration), extHostWorkspace, initData.configuration);
this._extensionService = new ExtHostExtensionService(initData, threadService, extHostWorkspace, this._extHostConfiguration);
this._extensionService = new ExtHostExtensionService(initData, threadService, extHostWorkspace, this._extHostConfiguration, logService);
// error forwarding and stack trace scanning
const extensionErrors = new WeakMap<Error, IExtensionDescription>();