ipc-iterate-error.js
This file
Path
test/fixtures/ipc-iterate-error.js
20 lines · 464 bytes · JavaScript
Last changed by
Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454
History of this fileTake it
Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
lines 1–2why, one step back1#!/usr/bin/env node2import process from 'node:process';Do not disconnect IPC on `error` event on process (#1086)ehmickybefore adoptiond6f5d9a
line 3why, one step back3import {sendMessage, getEachMessage} from '../../index.js';Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
lines 4–5why, one step back4import {foobarString} from '../helpers/input.js';5Do not disconnect IPC on `error` event on process (#1086)ehmickybefore adoptiond6f5d9a
lines 6–16why, one step back6const echoMessages = async () => {7 for await (const message of getEachMessage()) {8 if (message === foobarString) {9 break;10 }1112 await sendMessage(message);13 }14};1516process.on('error', () => {});Require Node.js 22 (#1243)Sindre Sorhusbefore adoption04b4454
line 17why, one step back17Do not disconnect IPC on `error` event on process (#1086)ehmickybefore adoptiond6f5d9a
lines 18–20why, one step back18const promise = echoMessages();19process.emit('error', new Error(foobarString));20await promise;