src/vs/workbench/services/extensions/electron-browser/localProcessExtensionHost.ts/LocalProcessExtensionHost/write
class LocalProcessExtensionHost:	private _handleProcessOutputStream(stream: Readable) {
		let last = '';
		let isOmitting = false;
		const event = new Emitter<string>();
		const decoder = new StringDecoder('utf-8');
		stream.pipe(new Writable({
			write(chunk, _encoding, callback) {
				// not a fancy approach, but this is the same approach used by the split2
				// module which is well-optimized (https://github.com/mcollina/split2)
				last += typeof chunk === 'string' ? chunk : decoder.write(chunk);
				let lines = last.split(/\r?\n/g);
				last = lines.pop()!;

				// protected against an extension spamming and leaking memory if no new line is written.
				if (last.length > 10_000) {
					lines.push(last);
					last = '';
				}

				for (const line of lines) {
					if (isOmitting) {
						if (line === NativeLogMarkers.End) {
							isOmitting = false;
						}
					} else if (line === NativeLogMarkers.Start) {
						isOmitting = true;
					} else if (line.length) {
						event.fire(line + '\n');
					}
				}

				callback();
			}
		}));

		return event;
	}