MCPcopy Index your code
hub / github.com/open-cli-tools/concurrently / OutputErrorHandler

Class OutputErrorHandler

lib/flow-control/output-error-handler.ts:10–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8 * Kills processes and aborts further command spawning on output stream error (namely, SIGPIPE).
9 */
10export class OutputErrorHandler implements FlowController {
11 private readonly outputStream: Writable;
12 private readonly abortController: AbortController;
13
14 constructor({
15 abortController,
16 outputStream,
17 }: {
18 abortController: AbortController;
19 outputStream: Writable;
20 }) {
21 this.abortController = abortController;
22 this.outputStream = outputStream;
23 }
24
25 handle(commands: Command[]): { commands: Command[]; onFinish: () => void } {
26 const subscription = fromSharedEvent(this.outputStream, 'error').subscribe(() => {
27 commands.forEach((command) => command.kill());
28
29 // Avoid further commands from spawning, e.g. if `RestartProcess` is used.
30 this.abortController.abort();
31 });
32
33 return {
34 commands,
35 onFinish: () => subscription.unsubscribe(),
36 };
37 }
38}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…