src/vs/workbench/services/extensions/common/extensionHostMain.ts/ExtensionHostMain/terminate
class ExtensionHostMain:	terminate(reason: string): void {
		if (this._isTerminating) {
			// we are already shutting down...
			return;
		}
		this._isTerminating = true;
		this._logService.info(`extension host terminating: ${reason}`);
		this._logService.flush();

		this._disposables.dispose();

		errors.setUnexpectedErrorHandler((err) => {
			this._logService.error(err);
		});

		// Invalidate all proxies
		this._rpcProtocol.dispose();

		const extensionsDeactivated = this._extensionService.deactivateAll();

		// Give extensions 1 second to wrap up any async dispose, then exit in at most 4 seconds
		setTimeout(() => {
			Promise.race([timeout(4000), extensionsDeactivated]).finally(() => {
				this._logService.info(`exiting with code 0`);
				this._logService.flush();
				this._logService.dispose();
				this._hostUtils.exit(0);
			});
		}, 1000);
	}