src/vs/platform/sharedProcess/electron-browser/sharedProcessWorkerMain.ts/SharedProcessWorkerProcess/spawn
class SharedProcessWorkerProcess:	spawn(): void {
		Logger.trace('Forking worker process');

		// Fork module via bootstrap-fork for AMD support
		this.child = fork(
			this.environment.bootstrapPath,
			[`--type=${this.configuration.process.type}`],
			{ env: this.getEnv() }
		);

		Logger.info(`Starting worker process with pid ${this.child.pid} (type: ${this.configuration.process.type}, window: ${this.configuration.reply.windowId}).`);

		// Re-emit errors to outside
		const onError = Event.fromNodeEventEmitter(this.child, 'error');
		this._register(onError(error => Logger.warn(`Error from child process: ${toErrorMessage(error)}`)));

		// Handle termination that happens from the process
		// itself. This can either be a crash or the process
		// not being long running.
		const onExit = Event.fromNodeEventEmitter<{ code: number | null; signal: NodeJS.Signals | null }>(this.child, 'exit', (code: number | null, signal: NodeJS.Signals | null) => ({ code, signal }));
		this._register(onExit(({ code, signal }) => {
			const logMsg = `Worker process with pid ${this.child?.pid} terminated by itself with code ${code}, signal: ${signal} (type: ${this.configuration.process.type}, window: ${this.configuration.reply.windowId})`;
			if (code !== 0 && signal !== 'SIGTERM') {
				Logger.error(logMsg);
			} else {
				Logger.info(logMsg);
			}

			this.child = undefined;

			this._onDidProcessSelfTerminate.fire({
				code: withNullAsUndefined(code),
				signal: withNullAsUndefined(signal)
			});
		}));

		const onMessageEmitter = this._register(new Emitter<VSBuffer>());
		const onRawMessage = Event.fromNodeEventEmitter(this.child, 'message', msg => msg);
		this._register(onRawMessage(msg => {

			// Handle remote console logs specially
			if (isRemoteConsoleLog(msg)) {
				log(msg, `SharedProcess worker`);
			}

			// Anything else goes to the outside
			else {
				onMessageEmitter.fire(VSBuffer.wrap(Buffer.from(msg, 'base64')));
			}
		}));

		const send = (buffer: VSBuffer) => {
			if (this.child?.connected) {
				this.child.send((<Buffer>buffer.buffer).toString('base64'));
			} else {
				Logger.warn('Unable to deliver message to disconnected child');
			}
		};

		// Re-emit messages from the process via the port
		const onMessage = onMessageEmitter.event;
		this._register(onMessage(message => this.port.postMessage(message.buffer)));

		// Relay message from the port into the process
		this.port.onmessage = (e => send(VSBuffer.wrap(e.data)));
		this._register(toDisposable(() => this.port.onmessage = null));
	}