Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

397 B
Raw Blame
type Writable = {
  on(event: "error", listener: (error: NodeJS.ErrnoException) => void): unknown;
};

export function exitOnClosedPipe(
  streams: ReadonlyArray<Writable>,
  exit: (code: number) => void = (code) => process.exit(code),
): void {
  for (const stream of streams) {
    stream.on("error", (error) => {
      if (error.code === "EPIPE") exit(0);
      else throw error;
    });
  }
}