extensionHost.ts 19.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

'use strict';

import * as nls from 'vs/nls';
import { toErrorMessage } from 'vs/base/common/errorMessage';
import { stringify } from 'vs/base/common/marshalling';
import * as objects from 'vs/base/common/objects';
import URI from 'vs/base/common/uri';
import { TPromise } from 'vs/base/common/winjs.base';
14
import { isWindows, isLinux } from 'vs/base/common/platform';
15 16 17
import { findFreePort } from 'vs/base/node/ports';
import { IMessageService, Severity } from 'vs/platform/message/common/message';
import { ILifecycleService, ShutdownEvent } from 'vs/platform/lifecycle/common/lifecycle';
18
import { IWindowsService, IWindowService } from 'vs/platform/windows/common/windows';
19
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
20
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
21 22
import { ChildProcess, fork } from 'child_process';
import { ipcRenderer as ipc } from 'electron';
23
import product from 'vs/platform/node/product';
24 25
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IMessagePassingProtocol } from 'vs/base/parts/ipc/common/ipc';
26
import { generateRandomPipeName, Protocol } from 'vs/base/parts/ipc/node/ipc.net';
A
Alex Dima 已提交
27
import { createServer, Server, Socket } from 'net';
J
Joao Moreno 已提交
28
import Event, { Emitter, debounceEvent, mapEvent, anyEvent, fromNodeEventEmitter } from 'vs/base/common/event';
S
Sandeep Somavarapu 已提交
29
import { IInitData, IWorkspaceData, IConfigurationInitData } from 'vs/workbench/api/node/extHost.protocol';
B
Benjamin Pasero 已提交
30
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
31
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
32
import { ICrashReporterService } from 'vs/workbench/services/crashReporter/electron-browser/crashReporterService';
33
import { IBroadcastService, IBroadcast } from 'vs/platform/broadcast/electron-browser/broadcastService';
B
Benjamin Pasero 已提交
34
import { isEqual } from 'vs/base/common/paths';
35
import { EXTENSION_CLOSE_EXTHOST_BROADCAST_CHANNEL, EXTENSION_RELOAD_BROADCAST_CHANNEL, EXTENSION_ATTACH_BROADCAST_CHANNEL, EXTENSION_LOG_BROADCAST_CHANNEL, EXTENSION_TERMINATE_BROADCAST_CHANNEL } from 'vs/platform/extensions/common/extensionHost';
B
Benjamin Pasero 已提交
36
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
37
import { IRemoteConsoleLog, log, parse } from 'vs/base/node/console';
S
Sandeep Somavarapu 已提交
38
import { getScopes } from 'vs/platform/configuration/common/configurationRegistry';
39 40

export class ExtensionHostProcessWorker {
41

42 43 44 45 46
	private _onCrashed: Emitter<[number, string]> = new Emitter<[number, string]>();
	public readonly onCrashed: Event<[number, string]> = this._onCrashed.event;

	private readonly _toDispose: IDisposable[];

A
Alex Dima 已提交
47 48 49
	private readonly _isExtensionDevHost: boolean;
	private readonly _isExtensionDevDebug: boolean;
	private readonly _isExtensionDevDebugBrk: boolean;
A
Alex Dima 已提交
50 51 52 53 54
	private readonly _isExtensionDevTestFromCli: boolean;

	// State
	private _lastExtensionHostError: string;
	private _terminating: boolean;
55

56
	// Resources, in order they get acquired/created when .start() is called:
A
Alex Dima 已提交
57
	private _namedPipeServer: Server;
58
	private _inspectPort: number;
A
Alex Dima 已提交
59 60
	private _extensionHostProcess: ChildProcess;
	private _extensionHostConnection: Socket;
61
	private _messageProtocol: TPromise<IMessagePassingProtocol>;
62 63

	constructor(
64
		/* intentionally not injected */private readonly _extensionService: IExtensionService,
A
Alex Dima 已提交
65 66 67 68 69 70 71 72 73 74
		@IWorkspaceContextService private readonly _contextService: IWorkspaceContextService,
		@IMessageService private readonly _messageService: IMessageService,
		@IWindowsService private readonly _windowsService: IWindowsService,
		@IWindowService private readonly _windowService: IWindowService,
		@IBroadcastService private readonly _broadcastService: IBroadcastService,
		@ILifecycleService private readonly _lifecycleService: ILifecycleService,
		@IEnvironmentService private readonly _environmentService: IEnvironmentService,
		@IWorkspaceConfigurationService private readonly _configurationService: IWorkspaceConfigurationService,
		@ITelemetryService private readonly _telemetryService: ITelemetryService,
		@ICrashReporterService private readonly _crashReporterService: ICrashReporterService
75 76
	) {
		// handle extension host lifecycle a bit special when we know we are developing an extension that runs inside
A
Alex Dima 已提交
77 78 79 80
		this._isExtensionDevHost = this._environmentService.isExtensionDevelopment;
		this._isExtensionDevDebug = (typeof this._environmentService.debugExtensionHost.port === 'number');
		this._isExtensionDevDebugBrk = !!this._environmentService.debugExtensionHost.break;
		this._isExtensionDevTestFromCli = this._isExtensionDevHost && !!this._environmentService.extensionTestsPath && !this._environmentService.debugExtensionHost.break;
81

A
Alex Dima 已提交
82 83 84 85 86
		this._lastExtensionHostError = null;
		this._terminating = false;

		this._namedPipeServer = null;
		this._extensionHostProcess = null;
87 88
		this._extensionHostConnection = null;
		this._messageProtocol = null;
A
Alex Dima 已提交
89

90 91 92 93 94 95 96 97 98 99 100 101 102 103
		this._toDispose = [];
		this._toDispose.push(this._onCrashed);
		this._toDispose.push(this._lifecycleService.onWillShutdown((e) => this._onWillShutdown(e)));
		this._toDispose.push(this._lifecycleService.onShutdown(reason => this.terminate()));
		this._toDispose.push(this._broadcastService.onBroadcast(b => this._onBroadcast(b)));

		const globalExitListener = () => this.terminate();
		process.once('exit', globalExitListener);
		this._toDispose.push({
			dispose: () => {
				process.removeListener('exit', globalExitListener);
			}
		});
	}
A
Alex Dima 已提交
104

105 106
	public dispose(): void {
		this.terminate();
107 108
	}

A
Alex Dima 已提交
109
	private _onBroadcast(broadcast: IBroadcast): void {
110 111

		// Close Ext Host Window Request
A
Alex Dima 已提交
112
		if (broadcast.channel === EXTENSION_CLOSE_EXTHOST_BROADCAST_CHANNEL && this._isExtensionDevHost) {
113
			const extensionPaths = broadcast.payload as string[];
A
Alex Dima 已提交
114 115
			if (Array.isArray(extensionPaths) && extensionPaths.some(path => isEqual(this._environmentService.extensionDevelopmentPath, path, !isLinux))) {
				this._windowService.closeWindow();
116 117
			}
		}
118

A
Alex Dima 已提交
119
		if (broadcast.channel === EXTENSION_RELOAD_BROADCAST_CHANNEL && this._isExtensionDevHost) {
120
			const extensionPaths = broadcast.payload as string[];
A
Alex Dima 已提交
121 122
			if (Array.isArray(extensionPaths) && extensionPaths.some(path => isEqual(this._environmentService.extensionDevelopmentPath, path, !isLinux))) {
				this._windowService.reloadWindow();
123 124
			}
		}
125 126
	}

127
	public start(): TPromise<IMessagePassingProtocol> {
128 129 130 131
		if (this._terminating) {
			// .terminate() was called
			return null;
		}
J
Joao Moreno 已提交
132

133 134 135 136 137 138 139
		if (!this._messageProtocol) {
			this._messageProtocol = TPromise.join<any>([this._tryListenOnPipe(), this._tryFindDebugPort()]).then((data: [string, number]) => {
				const pipeName = data[0];
				// The port will be 0 if there's no need to debug or if a free port was not found
				const port = data[1];

				const opts = {
J
Johannes Rieken 已提交
140
					env: objects.mixin(objects.deepClone(process.env), {
141 142 143 144 145
						AMD_ENTRYPOINT: 'vs/workbench/node/extensionHostProcess',
						PIPE_LOGGING: 'true',
						VERBOSE_LOGGING: true,
						VSCODE_WINDOW_ID: String(this._windowService.getCurrentWindowId()),
						VSCODE_IPC_HOOK_EXTHOST: pipeName,
J
Johannes Rieken 已提交
146
						VSCODE_HANDLES_UNCAUGHT_ERRORS: true,
147 148
						ELECTRON_NO_ASAR: '1',
						VSCODE_LOG_STACK: !this._isExtensionDevTestFromCli && (this._isExtensionDevHost || !this._environmentService.isBuilt || product.quality !== 'stable' || this._environmentService.verbose)
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
					}),
					// We only detach the extension host on windows. Linux and Mac orphan by default
					// and detach under Linux and Mac create another process group.
					// We detach because we have noticed that when the renderer exits, its child processes
					// (i.e. extension host) are taken down in a brutal fashion by the OS
					detached: !!isWindows,
					execArgv: port
						? ['--nolazy', (this._isExtensionDevDebugBrk ? '--inspect-brk=' : '--inspect=') + port]
						: undefined,
					silent: true
				};

				const crashReporterOptions = this._crashReporterService.getChildProcessStartOptions('extensionHost');
				if (crashReporterOptions) {
					opts.env.CRASH_REPORTER_START_OPTIONS = JSON.stringify(crashReporterOptions);
164 165
				}

166 167 168 169 170 171 172
				// Run Extension Host as fork of current process
				this._extensionHostProcess = fork(URI.parse(require.toUrl('bootstrap')).fsPath, ['--type=extensionHost'], opts);

				// Catch all output coming from the extension host process
				type Output = { data: string, format: string[] };
				this._extensionHostProcess.stdout.setEncoding('utf8');
				this._extensionHostProcess.stderr.setEncoding('utf8');
J
Joao Moreno 已提交
173 174
				const onStdout = fromNodeEventEmitter<string>(this._extensionHostProcess.stdout, 'data');
				const onStderr = fromNodeEventEmitter<string>(this._extensionHostProcess.stderr, 'data');
175
				const onOutput = anyEvent(
176 177 178 179 180 181 182 183 184 185 186 187 188
					mapEvent(onStdout, o => ({ data: `%c${o}`, format: [''] })),
					mapEvent(onStderr, o => ({ data: `%c${o}`, format: ['color: red'] }))
				);

				// Debounce all output, so we can render it in the Chrome console as a group
				const onDebouncedOutput = debounceEvent<Output>(onOutput, (r, o) => {
					return r
						? { data: r.data + o.data, format: [...r.format, ...o.format] }
						: { data: o.data, format: o.format };
				}, 100);

				// Print out extension host output
				onDebouncedOutput(data => {
189 190 191 192 193 194 195 196
					const inspectorUrlIndex = !this._environmentService.isBuilt && data.data && data.data.indexOf('chrome-devtools://');
					if (inspectorUrlIndex >= 0) {
						console.log(`%c[Extension Host] %cdebugger inspector at ${data.data.substr(inspectorUrlIndex)}`, 'color: blue', 'color: black');
					} else {
						console.group('Extension Host');
						console.log(data.data, ...data.format);
						console.groupEnd();
					}
197
				});
198

199 200
				// Support logging from extension host
				this._extensionHostProcess.on('message', msg => {
201 202
					if (msg && (<IRemoteConsoleLog>msg).type === '__$console') {
						this._logExtensionHostMessage(<IRemoteConsoleLog>msg);
203
					}
B
Benjamin Pasero 已提交
204
				});
205

206 207
				// Lifecycle
				this._extensionHostProcess.on('error', (err) => this._onExtHostProcessError(err));
208
				this._extensionHostProcess.on('exit', (code: number, signal: string) => this._onExtHostProcessExit(code, signal));
209

210 211 212 213 214 215 216 217 218 219
				// Notify debugger that we are ready to attach to the process if we run a development extension
				if (this._isExtensionDevHost && port) {
					this._broadcastService.broadcast({
						channel: EXTENSION_ATTACH_BROADCAST_CHANNEL,
						payload: {
							debugId: this._environmentService.debugExtensionHost.debugId,
							port
						}
					});
				}
220
				this._inspectPort = port;
221 222 223 224 225 226 227 228 229 230 231 232

				// Help in case we fail to start it
				let startupTimeoutHandle: number;
				if (!this._environmentService.isBuilt || this._isExtensionDevHost) {
					startupTimeoutHandle = setTimeout(() => {
						const msg = this._isExtensionDevDebugBrk
							? nls.localize('extensionHostProcess.startupFailDebug', "Extension host did not start in 10 seconds, it might be stopped on the first line and needs a debugger to continue.")
							: nls.localize('extensionHostProcess.startupFail', "Extension host did not start in 10 seconds, that might be a problem.");

						this._messageService.show(Severity.Warning, msg);
					}, 10000);
				}
233

234 235 236 237 238
				// Initialize extension host process with hand shakes
				return this._tryExtHostHandshake().then((protocol) => {
					clearTimeout(startupTimeoutHandle);
					return protocol;
				});
239
			});
240 241 242
		}

		return this._messageProtocol;
243
	}
244

A
Alex Dima 已提交
245
	/**
246
	 * Start a server (`this._namedPipeServer`) that listens on a named pipe and return the named pipe name.
A
Alex Dima 已提交
247
	 */
248 249 250
	private _tryListenOnPipe(): TPromise<string> {
		return new TPromise<string>((resolve, reject) => {
			const pipeName = generateRandomPipeName();
A
Alex Dima 已提交
251 252 253

			this._namedPipeServer = createServer();
			this._namedPipeServer.on('error', reject);
254
			this._namedPipeServer.listen(pipeName, () => {
A
Alex Dima 已提交
255
				this._namedPipeServer.removeListener('error', reject);
256
				resolve(pipeName);
257
			});
258
		});
259 260
	}

A
Alex Dima 已提交
261 262 263
	/**
	 * Find a free port if extension host debugging is enabled.
	 */
A
Alex Dima 已提交
264 265
	private _tryFindDebugPort(): TPromise<number> {
		const extensionHostPort = this._environmentService.debugExtensionHost.port;
266
		if (typeof extensionHostPort !== 'number') {
A
Alex Dima 已提交
267
			return TPromise.wrap<number>(0);
268 269
		}
		return new TPromise<number>((c, e) => {
270
			return findFreePort(extensionHostPort, 10 /* try 10 ports */, 5000 /* try up to 5 seconds */).then(port => {
271 272
				if (!port) {
					console.warn('%c[Extension Host] %cCould not find a free port for debugging', 'color: blue', 'color: black');
B
Benjamin Pasero 已提交
273
					return c(void 0);
274 275
				}
				if (port !== extensionHostPort) {
B
Benjamin Pasero 已提交
276
					console.warn(`%c[Extension Host] %cProvided debugging port ${extensionHostPort} is not free, using ${port} instead.`, 'color: blue', 'color: black');
277
				}
A
Alex Dima 已提交
278
				if (this._isExtensionDevDebugBrk) {
B
Benjamin Pasero 已提交
279
					console.warn(`%c[Extension Host] %cSTOPPED on first line for debugging on port ${port}`, 'color: blue', 'color: black');
280
				} else {
B
Benjamin Pasero 已提交
281
					console.info(`%c[Extension Host] %cdebugger listening on port ${port}`, 'color: blue', 'color: black');
282 283 284 285 286 287
				}
				return c(port);
			});
		});
	}

288
	private _tryExtHostHandshake(): TPromise<IMessagePassingProtocol> {
289

290
		return new TPromise<IMessagePassingProtocol>((resolve, reject) => {
A
Alex Dima 已提交
291

A
Alex Dima 已提交
292 293
			// Wait for the extension host to connect to our named pipe
			// and wrap the socket in the message passing protocol
294 295 296 297 298 299
			let handle = setTimeout(() => {
				this._namedPipeServer.close();
				this._namedPipeServer = null;
				reject('timeout');
			}, 60 * 1000);

A
Alex Dima 已提交
300
			this._namedPipeServer.on('connection', socket => {
301
				clearTimeout(handle);
302 303
				this._namedPipeServer.close();
				this._namedPipeServer = null;
A
Alex Dima 已提交
304
				this._extensionHostConnection = socket;
305
				resolve(new Protocol(this._extensionHostConnection));
306
			});
307

308
		}).then((protocol) => {
A
Alex Dima 已提交
309 310 311

			// 1) wait for the incoming `ready` event and send the initialization data.
			// 2) wait for the incoming `initialized` event.
312
			return new TPromise<IMessagePassingProtocol>((resolve, reject) => {
A
Alex Dima 已提交
313

314 315 316 317 318
				let handle = setTimeout(() => {
					reject('timeout');
				}, 60 * 1000);

				const disposable = protocol.onMessage(msg => {
319

320
					if (msg === 'ready') {
321 322
						// 1) Extension Host is ready to receive messages, initialize it
						this._createExtHostInitData().then(data => protocol.send(stringify(data)));
A
Alex Dima 已提交
323 324 325 326
						return;
					}

					if (msg === 'initialized') {
327 328 329
						// 2) Extension Host is initialized

						clearTimeout(handle);
A
Alex Dima 已提交
330 331 332 333 334

						// stop listening for messages here
						disposable.dispose();

						// release this promise
335
						resolve(protocol);
A
Alex Dima 已提交
336
						return;
337
					}
A
Alex Dima 已提交
338 339

					console.error(`received unexpected message during handshake phase from the extension host: `, msg);
340
				});
A
Alex Dima 已提交
341

342
			});
A
Alex Dima 已提交
343

344 345 346
		});
	}

A
Alex Dima 已提交
347
	private _createExtHostInitData(): TPromise<IInitData> {
348
		return TPromise.join<any>([this._telemetryService.getTelemetryInfo(), this._extensionService.getExtensions()]).then(([telemetryInfo, extensionDescriptions]) => {
S
Sandeep Somavarapu 已提交
349
			const configurationData: IConfigurationInitData = { ...this._configurationService.getConfigurationData(), configurationScopes: [] };
A
Alex Dima 已提交
350
			const r: IInitData = {
351 352
				parentPid: process.pid,
				environment: {
A
Alex Dima 已提交
353
					isExtensionDevelopmentDebug: this._isExtensionDevDebug,
J
Johannes Rieken 已提交
354
					appRoot: this._environmentService.appRoot,
A
Alex Dima 已提交
355 356 357 358 359
					appSettingsHome: this._environmentService.appSettingsHome,
					disableExtensions: this._environmentService.disableExtensions,
					userExtensionsHome: this._environmentService.extensionsPath,
					extensionDevelopmentPath: this._environmentService.extensionDevelopmentPath,
					extensionTestsPath: this._environmentService.extensionTestsPath,
360
					// globally disable proposed api when built and not insiders developing extensions
A
Alex Dima 已提交
361 362
					enableProposedApiForAll: !this._environmentService.isBuilt || (!!this._environmentService.extensionDevelopmentPath && product.nameLong.indexOf('Insiders') >= 0),
					enableProposedApiFor: this._environmentService.args['enable-proposed-api'] || []
363
				},
364
				workspace: this._contextService.getWorkbenchState() === WorkbenchState.EMPTY ? null : <IWorkspaceData>this._contextService.getWorkspace(),
365
				extensions: extensionDescriptions,
S
Sandeep Somavarapu 已提交
366 367
				// Send configurations scopes only in development mode.
				configuration: !this._environmentService.isBuilt || this._environmentService.isExtensionDevelopment ? { ...configurationData, configurationScopes: getScopes(this._configurationService.keys().default) } : configurationData,
J
Joao Moreno 已提交
368 369
				telemetryInfo,
				args: this._environmentService.args,
370 371
				execPath: this._environmentService.execPath,
				windowId: this._windowService.getCurrentWindowId()
372
			};
373
			return r;
374 375 376
		});
	}

377
	private _logExtensionHostMessage(entry: IRemoteConsoleLog) {
378 379

		// Send to local console unless we run tests from cli
A
Alex Dima 已提交
380
		if (!this._isExtensionDevTestFromCli) {
381
			log(entry, 'Extension Host');
382 383 384
		}

		// Log on main side if running tests from cli
A
Alex Dima 已提交
385
		if (this._isExtensionDevTestFromCli) {
386
			this._windowsService.log(entry.severity, ...parse(entry).args);
387 388 389
		}

		// Broadcast to other windows if we are in development mode
A
Alex Dima 已提交
390 391
		else if (!this._environmentService.isBuilt || this._isExtensionDevHost) {
			this._broadcastService.broadcast({
392
				channel: EXTENSION_LOG_BROADCAST_CHANNEL,
393
				payload: {
394
					logEntry: entry,
A
Alex Dima 已提交
395
					debugId: this._environmentService.debugExtensionHost.debugId
396
				}
B
Benjamin Pasero 已提交
397
			});
398 399 400
		}
	}

A
Alex Dima 已提交
401
	private _onExtHostProcessError(err: any): void {
402
		let errorMessage = toErrorMessage(err);
A
Alex Dima 已提交
403
		if (errorMessage === this._lastExtensionHostError) {
404 405 406
			return; // prevent error spam
		}

A
Alex Dima 已提交
407
		this._lastExtensionHostError = errorMessage;
408

A
Alex Dima 已提交
409
		this._messageService.show(Severity.Error, nls.localize('extensionHostProcess.error', "Error from the extension host: {0}", errorMessage));
410 411
	}

A
Alex Dima 已提交
412 413 414
	private _onExtHostProcessExit(code: number, signal: string): void {
		if (this._terminating) {
			// Expected termination path (we asked the process to terminate)
A
Alex Dima 已提交
415 416
			return;
		}
417

A
Alex Dima 已提交
418 419
		// Unexpected termination
		if (!this._isExtensionDevHost) {
420
			this._onCrashed.fire([code, signal]);
A
Alex Dima 已提交
421
		}
422

A
Alex Dima 已提交
423 424 425 426 427 428 429 430
		// Expected development extension termination: When the extension host goes down we also shutdown the window
		else if (!this._isExtensionDevTestFromCli) {
			this._windowService.closeWindow();
		}

		// When CLI testing make sure to exit with proper exit code
		else {
			ipc.send('vscode:exit', code);
431 432 433
		}
	}

434 435 436 437
	public getInspectPort(): number {
		return this._inspectPort;
	}

438
	public terminate(): void {
439 440 441
		if (this._terminating) {
			return;
		}
A
Alex Dima 已提交
442 443
		this._terminating = true;

444 445
		dispose(this._toDispose);

446 447 448 449 450 451
		if (!this._messageProtocol) {
			// .start() was not called
			return;
		}

		this._messageProtocol.then((protocol) => {
452 453 454

			// Send the extension host a request to terminate itself
			// (graceful termination)
455
			protocol.send({
456 457
				type: '__$terminate'
			});
458 459 460 461 462 463 464 465 466 467

			// Give the extension host 60s, after which we will
			// try to kill the process and release any resources
			setTimeout(() => this._cleanResources(), 60 * 1000);

		}, (err) => {

			// Establishing a protocol with the extension host failed, so
			// try to kill the process and release any resources.
			this._cleanResources();
468
		});
469
	}
470

471 472 473 474 475 476 477 478 479 480 481 482 483
	private _cleanResources(): void {
		if (this._namedPipeServer) {
			this._namedPipeServer.close();
			this._namedPipeServer = null;
		}
		if (this._extensionHostConnection) {
			this._extensionHostConnection.end();
			this._extensionHostConnection = null;
		}
		if (this._extensionHostProcess) {
			this._extensionHostProcess.kill();
			this._extensionHostProcess = null;
		}
484 485 486 487 488 489
	}

	private _onWillShutdown(event: ShutdownEvent): void {

		// If the extension development host was started without debugger attached we need
		// to communicate this back to the main side to terminate the debug session
A
Alex Dima 已提交
490 491
		if (this._isExtensionDevHost && !this._isExtensionDevTestFromCli && !this._isExtensionDevDebug) {
			this._broadcastService.broadcast({
492
				channel: EXTENSION_TERMINATE_BROADCAST_CHANNEL,
493
				payload: {
A
Alex Dima 已提交
494
					debugId: this._environmentService.debugExtensionHost.debugId
495
				}
B
Benjamin Pasero 已提交
496
			});
497 498 499 500

			event.veto(TPromise.timeout(100 /* wait a bit for IPC to get delivered */).then(() => false));
		}
	}
501
}