Skip to content
Myr

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 file

Take it

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

lines 1–2why, one step back
1#!/usr/bin/env node
2import process from 'node:process';

Do not disconnect IPC on `error` event on process (#1086)ehmickybefore adoptiond6f5d9a

line 3why, one step back
3import {sendMessage, getEachMessage} from '../../index.js';

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

lines 4–5why, one step back
4import {foobarString} from '../helpers/input.js';
5

Do not disconnect IPC on `error` event on process (#1086)ehmickybefore adoptiond6f5d9a

lines 6–16why, one step back
6const 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 back
17

Do not disconnect IPC on `error` event on process (#1086)ehmickybefore adoptiond6f5d9a

lines 18–20why, one step back
18const promise = echoMessages();
19process.emit('error', new Error(foobarString));20await promise;