MCPcopy
hub / github.com/open-cli-tools/concurrently / maybeSetupIPC

Method maybeSetupIPC

lib/command.ts:260–285  ·  view source on GitHub ↗
(child: ChildProcess)

Source from the content-addressed store, hash-verified

258 }
259
260 private maybeSetupIPC(child: ChildProcess) {
261 if (!this.ipc) {
262 return [];
263 }
264
265 return [
266 pipeTo(
267 Rx.fromEvent(child, 'message').pipe(
268 Rx.map((event) => {
269 const [message, handle] = event as [object, SendHandle | undefined];
270 return { message, handle };
271 }),
272 ),
273 this.messages.incoming,
274 ),
275 this.messages.outgoing.subscribe((message) => {
276 if (!child.send) {
277 return message.onSent(new Error('Command does not have an IPC channel'));
278 }
279
280 child.send(message.message, message.handle, message.options, (error) => {
281 message.onSent(error);
282 });
283 }),
284 ];
285 }
286
287 /**
288 * Sends a message to the underlying process once it starts.

Callers 1

startMethod · 0.95

Calls 3

pipeToFunction · 0.85
onSentMethod · 0.80
sendMethod · 0.80

Tested by

no test coverage detected