Skip to content
Myr

Add `filter` option to `getOneMessage()` (#1076)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by ehmicky · committed by GitHub · parent ae9b360 · Browse files · 15 files+215 added−64 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

15 files+215 added−64 removed

  • tests:+90 added−31 removed
  • other:+125 added−33 removed

15 files+215 added−64 removed

modified:docs/api.md+17 added-3 removed
101 unmodified lines
102This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.103104[More info.](ipc.md#exchanging-messages)105106### getOneMessage()106### getOneMessage(getOneMessageOptions?)107108_getOneMessageOptions_: [`GetOneMessageOptions`](#getonemessageoptions)\109_Returns_: [`Promise<Message>`](ipc.md#message-type)110111Receive a single `message` from the parent process.112113This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.114115[More info.](ipc.md#exchanging-messages)116117#### getOneMessageOptions118119_Type_: `object`120121#### getOneMessageOptions.filter122123_Type_: [`(Message) => boolean`](ipc.md#message-type)124125Ignore any `message` that returns `false`.126127[More info.](ipc.md#filter-messages)128129### getEachMessage()130131_Returns_: [`AsyncIterable<Message>`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols)132
138 unmodified lines
271This requires the [`ipc`](#optionsipc) option to be `true`. The [type](ipc.md#message-type) of `message` depends on the [`serialization`](#optionsserialization) option.272273[More info.](ipc.md#exchanging-messages)274262### subprocess.getOneMessage()275### subprocess.getOneMessage(getOneMessageOptions?)276277_getOneMessageOptions_: [`GetOneMessageOptions`](#getonemessageoptions)\278_Returns_: [`Promise<Message>`](ipc.md#message-type)279280Receive a single `message` from the subprocess.281
631 unmodified lines
913914_Type:_ `boolean`\915_Default:_ `true` if either the [`node`](#optionsnode) option or the [`ipcInput`](#optionsipcinput) is set, `false` otherwise916903Enables exchanging messages with the subprocess using [`subprocess.sendMessage(message)`](#subprocesssendmessagemessage), [`subprocess.getOneMessage()`](#subprocessgetonemessage) and [`subprocess.getEachMessage()`](#subprocessgeteachmessage).917Enables exchanging messages with the subprocess using [`subprocess.sendMessage(message)`](#subprocesssendmessagemessage), [`subprocess.getOneMessage()`](#subprocessgetonemessagegetonemessageoptions) and [`subprocess.getEachMessage()`](#subprocessgeteachmessage).918919The subprocess must be a Node.js file.920921[More info.](ipc.md)
199 unmodified lines
modified:docs/execution.md+1 added-1 removed
modified:docs/input.md+1 added-1 removed
90 unmodified lines
91```9293## Any input type9495If the subprocess [uses Node.js](node.md), [almost any type](ipc.md#message-type) can be passed to the subprocess using the [`ipcInput`](ipc.md#send-an-initial-message) option. The subprocess retrieves that input using [`getOneMessage()`](api.md#getonemessage).95If the subprocess [uses Node.js](node.md), [almost any type](ipc.md#message-type) can be passed to the subprocess using the [`ipcInput`](ipc.md#send-an-initial-message) option. The subprocess retrieves that input using [`getOneMessage()`](api.md#getonemessagegetonemessageoptions).9697```js98// main.js99import {execaNode} from 'execa';
31 unmodified lines
modified:docs/ipc.md+25 added-3 removed
10 unmodified lines
11When the [`ipc`](api.md#optionsipc) option is `true`, the current process and subprocess can exchange messages. This only works if the subprocess is a [Node.js file](node.md).1213The `ipc` option defaults to `true` when using [`execaNode()`](node.md#run-nodejs-files) or the [`node`](node.md#run-nodejs-files) option.1415The current process sends messages with [`subprocess.sendMessage(message)`](api.md#subprocesssendmessagemessage) and receives them with [`subprocess.getOneMessage()`](api.md#subprocessgetonemessage). The subprocess uses [`sendMessage(message)`](api.md#sendmessagemessage) and [`getOneMessage()`](api.md#getonemessage) instead.15The current process sends messages with [`subprocess.sendMessage(message)`](api.md#subprocesssendmessagemessage) and receives them with [`subprocess.getOneMessage()`](api.md#subprocessgetonemessagegetonemessageoptions). The subprocess uses [`sendMessage(message)`](api.md#sendmessagemessage) and [`getOneMessage()`](api.md#getonemessagegetonemessageoptions) instead.1617```js18// parent.js19import {execaNode} from 'execa';
12 unmodified lines
32```3334## Listening to messages3536[`subprocess.getOneMessage()`](api.md#subprocessgetonemessage) and [`getOneMessage()`](api.md#getonemessage) read a single message. To listen to multiple messages in a row, [`subprocess.getEachMessage()`](api.md#subprocessgeteachmessage) and [`getEachMessage()`](api.md#geteachmessage) should be used instead.36[`subprocess.getOneMessage()`](api.md#subprocessgetonemessagegetonemessageoptions) and [`getOneMessage()`](api.md#getonemessagegetonemessageoptions) read a single message. To listen to multiple messages in a row, [`subprocess.getEachMessage()`](api.md#subprocessgeteachmessage) and [`getEachMessage()`](api.md#geteachmessage) should be used instead.3738[`subprocess.getEachMessage()`](api.md#subprocessgeteachmessage) waits for the subprocess to end (even when using [`break`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/break) or [`return`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/return)). It throws if the subprocess [fails](api.md#result). This means you do not need to `await` the subprocess' [promise](execution.md#result).3940```js
25 unmodified lines
66 await sendMessage(message + 1);67}68```6970## Filter messages7172```js73import {getOneMessage} from 'execa';7475const startMessage = await getOneMessage({76 filter: message => message.type === 'start',77});78```7980```js81import {getEachMessage} from 'execa';8283for await (const message of getEachMessage()) {84 if (message.type === 'start') {85 // ...86 }87}88```8990## Retrieve all messages9172The [`result.ipcOutput`](api.md#resultipcoutput) array contains all the messages sent by the subprocess. In many situations, this is simpler than using [`subprocess.getOneMessage()`](api.md#subprocessgetonemessage) and [`subprocess.getEachMessage()`](api.md#subprocessgeteachmessage).92The [`result.ipcOutput`](api.md#resultipcoutput) array contains all the messages sent by the subprocess. In many situations, this is simpler than using [`subprocess.getOneMessage()`](api.md#subprocessgetonemessagegetonemessageoptions) and [`subprocess.getEachMessage()`](api.md#subprocessgeteachmessage).9394```js95// main.js96import {execaNode} from 'execa';
40 unmodified lines
137138To limit messages to JSON instead, the [`serialization`](api.md#optionsserialization) option can be set to `'json'`.139140```js141import {execaNode} from 'execa';142143const subprocess = execaNode({serialization: 'json'})`child.js`;144```145146## Debugging
10 unmodified lines
modified:lib/ipc/get-one.js+24 added-7 removed
added:test/fixtures/ipc-echo-filter.js+5 added
added:test/fixtures/ipc-echo-twice-filter.js+8 added
added:test/fixtures/ipc-process-error-filter.js+11 added
1#!/usr/bin/env node2import process from 'node:process';3import {getOneMessage} from '../../index.js';4import {foobarString} from '../helpers/input.js';5import {alwaysPass} from '../helpers/ipc.js';67const cause = new Error(foobarString);8await Promise.all([9 getOneMessage({filter: alwaysPass}),10 process.emit('error', cause),11]);
modified:test/helpers/ipc.js+2 added
5 unmodified lines
6 }78 return messages;9};1011export const alwaysPass = () => true;
modified:test/ipc/buffer-messages.js+11 added
54 unmodified lines
55test('Sets empty error.ipcOutput, sync', t => {56 const {ipcOutput} = t.throws(() => execaSync('fail.js'));57 t.deepEqual(ipcOutput, []);58});5960test('"error" event interrupts result.ipcOutput', async t => {61 const subprocess = execa('ipc-echo-twice.js', {ipcInput: foobarString});62 t.is(await subprocess.getOneMessage(), foobarString);6364 const cause = new Error(foobarString);65 subprocess.emit('error', cause);66 const error = await t.throwsAsync(subprocess);67 t.is(error.cause, cause);68 t.deepEqual(error.ipcOutput, [foobarString]);69});
modified:test/ipc/get-one.js+53 added-31 removed
1 unmodified line
2import {setTimeout} from 'node:timers/promises';3import test from 'ava';4import {execa} from '../../index.js';5import {setFixtureDirectory} from '../helpers/fixtures-directory.js';6import {foobarString} from '../helpers/input.js';7import {iterateAllMessages} from '../helpers/ipc.js';6import {foobarString, foobarArray} from '../helpers/input.js';7import {iterateAllMessages, alwaysPass} from '../helpers/ipc.js';89setFixtureDirectory();1011const getOneSubprocessMessage = subprocess => subprocess.getOneMessage();12const getOneFilteredMessage = subprocess => subprocess.getOneMessage({filter: alwaysPass});1314const testKeepAlive = async (t, buffer) => {15 const subprocess = execa('ipc-echo-twice.js', {ipc: true, buffer});16 await subprocess.sendMessage(foobarString);
24 unmodified lines
41 await subprocess.sendMessage('.');42 await subprocess;43});4444test('Does not buffer initial message to current process, buffer true', async t => {45test.serial('Does not buffer initial message to current process, buffer true', async t => {46 const subprocess = execa('ipc-send-print.js', {ipc: true});47 const [chunk] = await once(subprocess.stdout, 'data');48 t.is(chunk.toString(), '.');49 await setTimeout(1e3);48 t.is(await Promise.race([setTimeout(1e3), subprocess.getOneMessage()]), undefined);50 t.is(await Promise.race([setTimeout(0), subprocess.getOneMessage()]), undefined);51 await subprocess.sendMessage('.');52 const {ipcOutput} = await subprocess;53 t.deepEqual(ipcOutput, [foobarString]);54});5556const HIGH_CONCURRENCY_COUNT = 100;5758test('subprocess.getOneMessage() can filter messages', async t => {59 const subprocess = execa('ipc-send-twice.js', {ipc: true});60 const message = await subprocess.getOneMessage({filter: message => message === foobarArray[1]});61 t.is(message, foobarArray[1]);6263 const {ipcOutput} = await subprocess;64 t.deepEqual(ipcOutput, foobarArray);65});6667test('exports.getOneMessage() can filter messages', async t => {68 const subprocess = execa('ipc-echo-filter.js', {ipc: true});69 await subprocess.sendMessage(foobarArray[0]);70 await subprocess.sendMessage(foobarArray[1]);7172 const {ipcOutput} = await subprocess;73 t.deepEqual(ipcOutput, [foobarArray[1]]);74});7576test.serial('Can retrieve initial IPC messages under heavy load, buffer false', async t => {77 await Promise.all(78 Array.from({length: HIGH_CONCURRENCY_COUNT}, async (_, index) => {79 const subprocess = execa('ipc-send-argv.js', [`${index}`], {ipc: true, buffer: false});
11 unmodified lines
91 }),92 );93});9475const testTwice = async (t, buffer) => {95const testTwice = async (t, buffer, filter) => {96 const subprocess = execa('ipc-send.js', {ipc: true, buffer});97 t.deepEqual(78 await Promise.all([subprocess.getOneMessage(), subprocess.getOneMessage()]),98 await Promise.all([subprocess.getOneMessage({filter}), subprocess.getOneMessage({filter})]),99 [foobarString, foobarString],100 );101 await subprocess;102};10384test('subprocess.getOneMessage() can be called twice at the same time, buffer false', testTwice, false);85test('subprocess.getOneMessage() can be called twice at the same time, buffer true', testTwice, true);104test('subprocess.getOneMessage() can be called twice at the same time, buffer false', testTwice, false, undefined);105test('subprocess.getOneMessage() can be called twice at the same time, buffer true', testTwice, true, undefined);106test('subprocess.getOneMessage() can be called twice at the same time, buffer false, filter', testTwice, false, alwaysPass);107test('subprocess.getOneMessage() can be called twice at the same time, buffer true, filter', testTwice, true, alwaysPass);10887const testCleanupListeners = async (t, buffer) => {109const testCleanupListeners = async (t, buffer, filter) => {110 const subprocess = execa('ipc-send.js', {ipc: true, buffer});111 const bufferCount = buffer ? 1 : 0;112113 t.is(subprocess.listenerCount('message'), bufferCount);114 t.is(subprocess.listenerCount('disconnect'), bufferCount);11594 const promise = subprocess.getOneMessage();116 const promise = subprocess.getOneMessage({filter});117 t.is(subprocess.listenerCount('message'), bufferCount + 1);118 t.is(subprocess.listenerCount('disconnect'), bufferCount + 1);119 t.is(await promise, foobarString);120
5 unmodified lines
126 t.is(subprocess.listenerCount('message'), 0);127 t.is(subprocess.listenerCount('disconnect'), 0);128};129108test('Cleans up subprocess.getOneMessage() listeners, buffer false', testCleanupListeners, false);109test('Cleans up subprocess.getOneMessage() listeners, buffer true', testCleanupListeners, true);130test('Cleans up subprocess.getOneMessage() listeners, buffer false', testCleanupListeners, false, undefined);131test('Cleans up subprocess.getOneMessage() listeners, buffer true', testCleanupListeners, true, undefined);132test('Cleans up subprocess.getOneMessage() listeners, buffer false, filter', testCleanupListeners, false, alwaysPass);133test('Cleans up subprocess.getOneMessage() listeners, buffer true, filter', testCleanupListeners, true, alwaysPass);134111test('"error" event interrupts result.ipcOutput', async t => {112 const subprocess = execa('ipc-echo-twice.js', {ipcInput: foobarString});113 t.is(await subprocess.getOneMessage(), foobarString);114115 const cause = new Error(foobarString);116 subprocess.emit('error', cause);117 const error = await t.throwsAsync(subprocess);118 t.is(error.cause, cause);119 t.deepEqual(error.ipcOutput, [foobarString]);120});121122const testParentDisconnect = async (t, buffer) => {123 const subprocess = execa('ipc-echo-twice.js', {ipc: true, buffer});135const testParentDisconnect = async (t, buffer, filter) => {136 const fixtureName = filter ? 'ipc-echo-twice-filter.js' : 'ipc-echo-twice.js';137 const subprocess = execa(fixtureName, {ipc: true, buffer});138 await subprocess.sendMessage(foobarString);139 t.is(await subprocess.getOneMessage(), foobarString);140141 subprocess.disconnect();
5 unmodified lines
147 t.true(message.includes('Error: getOneMessage() could not complete'));148 }149};150137test('subprocess.disconnect() interrupts exports.getOneMessage(), buffer false', testParentDisconnect, false);138test('subprocess.disconnect() interrupts exports.getOneMessage(), buffer true', testParentDisconnect, true);151test('subprocess.disconnect() interrupts exports.getOneMessage(), buffer false', testParentDisconnect, false, false);152test('subprocess.disconnect() interrupts exports.getOneMessage(), buffer true', testParentDisconnect, true, false);153test('subprocess.disconnect() interrupts exports.getOneMessage(), buffer false, filter', testParentDisconnect, false, true);154test('subprocess.disconnect() interrupts exports.getOneMessage(), buffer true, filter', testParentDisconnect, true, true);155140const testSubprocessDisconnect = async (t, buffer) => {156const testSubprocessDisconnect = async (t, buffer, filter) => {157 const subprocess = execa('empty.js', {ipc: true, buffer});142 await t.throwsAsync(subprocess.getOneMessage(), {158 await t.throwsAsync(subprocess.getOneMessage({filter}), {159 message: /subprocess\.getOneMessage\(\) could not complete/,160 });161 await subprocess;162};163148test('Subprocess exit interrupts disconnect.getOneMessage(), buffer false', testSubprocessDisconnect, false);149test('Subprocess exit interrupts disconnect.getOneMessage(), buffer true', testSubprocessDisconnect, true);164test('Subprocess exit interrupts disconnect.getOneMessage(), buffer false', testSubprocessDisconnect, false, undefined);165test('Subprocess exit interrupts disconnect.getOneMessage(), buffer true', testSubprocessDisconnect, true, undefined);166test('Subprocess exit interrupts disconnect.getOneMessage(), buffer false, filter', testSubprocessDisconnect, false, alwaysPass);167test('Subprocess exit interrupts disconnect.getOneMessage(), buffer true, filter', testSubprocessDisconnect, true, alwaysPass);168169const testParentError = async (t, getMessages, useCause, buffer) => {170 const subprocess = execa('ipc-echo.js', {ipc: true, buffer});171 await subprocess.sendMessage(foobarString);
15 unmodified lines
187};188189test('"error" event interrupts subprocess.getOneMessage(), buffer false', testParentError, getOneSubprocessMessage, false, false);190test('"error" event interrupts subprocess.getOneMessage(), buffer true', testParentError, getOneSubprocessMessage, false, true);191test('"error" event interrupts subprocess.getOneMessage(), buffer false, filter', testParentError, getOneFilteredMessage, false, false);192test('"error" event interrupts subprocess.getOneMessage(), buffer true, filter', testParentError, getOneFilteredMessage, false, true);193test('"error" event interrupts subprocess.getEachMessage(), buffer false', testParentError, iterateAllMessages, true, false);194test('"error" event interrupts subprocess.getEachMessage(), buffer true', testParentError, iterateAllMessages, true, true);195196const testSubprocessError = async (t, fixtureName, buffer) => {
11 unmodified lines
208};209210test('"error" event interrupts exports.getOneMessage(), buffer false', testSubprocessError, 'ipc-process-error.js', false);211test('"error" event interrupts exports.getOneMessage(), buffer true', testSubprocessError, 'ipc-process-error.js', true);212test('"error" event interrupts exports.getOneMessage(), buffer false, filter', testSubprocessError, 'ipc-process-error-filter.js', false);213test('"error" event interrupts exports.getOneMessage(), buffer true, filter', testSubprocessError, 'ipc-process-error-filter.js', true);214test('"error" event interrupts exports.getEachMessage(), buffer false', testSubprocessError, 'ipc-iterate-error.js', false);215test('"error" event interrupts exports.getEachMessage(), buffer true', testSubprocessError, 'ipc-iterate-error.js', true);
modified:test-d/ipc/get-each.test-d.ts+5 added-6 removed
4 unmodified lines
5 type Message,6 type Options,7} from '../../index.js';89for await (const message of getEachMessage()) {10 expectType<Message>(message);11}1213expectError(getEachMessage(''));149const subprocess = execa('test', {ipc: true});1011for await (const message of subprocess.getEachMessage()) {12 expectType<Message<'advanced'>>(message);
2 unmodified lines
15for await (const message of execa('test', {ipc: true, serialization: 'json'}).getEachMessage()) {16 expectType<Message<'json'>>(message);17}1819for await (const message of getEachMessage()) {20 expectType<Message>(message);21}2223expectError(subprocess.getEachMessage(''));24expectError(getEachMessage(''));2526execa('test', {ipcInput: ''}).getEachMessage();27execa('test', {ipcInput: '' as Message}).getEachMessage();28execa('test', {} as Options).getEachMessage?.();
9 unmodified lines
modified:test-d/ipc/get-one.test-d.ts+32 added-5 removed
4 unmodified lines
5 type Message,6 type Options,7} from '../../index.js';89const subprocess = execa('test', {ipc: true});10expectType<Promise<Message<'advanced'>>>(subprocess.getOneMessage());11const jsonSubprocess = execa('test', {ipc: true, serialization: 'json'});12expectType<Promise<Message<'json'>>>(jsonSubprocess.getOneMessage());13expectType<Promise<Message>>(getOneMessage());10expectError(await getOneMessage(''));1412const subprocess = execa('test', {ipc: true});13expectType<Message<'advanced'>>(await subprocess.getOneMessage());14expectType<Message<'json'>>(await execa('test', {ipc: true, serialization: 'json'}).getOneMessage());1515expectError(await subprocess.getOneMessage(''));16expectError(await getOneMessage(''));1718await execa('test', {ipcInput: ''}).getOneMessage();19await execa('test', {ipcInput: '' as Message}).getOneMessage();20await execa('test', {} as Options).getOneMessage?.();
4 unmodified lines
25expectType<undefined>(execa('test', {}).getOneMessage);26expectType<undefined>(execa('test', {ipc: false}).getOneMessage);27expectType<undefined>(execa('test', {ipcInput: undefined}).getOneMessage);28expectType<undefined>(execa('test', {ipc: false, ipcInput: ''}).getOneMessage);2930await subprocess.getOneMessage({filter: undefined} as const);31await subprocess.getOneMessage({filter: (message: Message<'advanced'>) => true} as const);32await jsonSubprocess.getOneMessage({filter: (message: Message<'json'>) => true} as const);33await jsonSubprocess.getOneMessage({filter: (message: Message<'advanced'>) => true} as const);34await subprocess.getOneMessage({filter: (message: Message<'advanced'> | bigint) => true} as const);35await subprocess.getOneMessage({filter: () => true} as const);36expectError(await subprocess.getOneMessage({filter: (message: Message<'advanced'>) => ''} as const));37// eslint-disable-next-line @typescript-eslint/no-empty-function38expectError(await subprocess.getOneMessage({filter(message: Message<'advanced'>) {}} as const));39expectError(await subprocess.getOneMessage({filter: (message: Message<'json'>) => true} as const));40expectError(await subprocess.getOneMessage({filter: (message: '') => true} as const));41expectError(await subprocess.getOneMessage({filter: true} as const));42expectError(await subprocess.getOneMessage({unknownOption: true} as const));4344await getOneMessage({filter: undefined} as const);45await getOneMessage({filter: (message: Message) => true} as const);46await getOneMessage({filter: (message: Message<'advanced'>) => true} as const);47await getOneMessage({filter: (message: Message | bigint) => true} as const);48await getOneMessage({filter: () => true} as const);49expectError(await getOneMessage({filter: (message: Message) => ''} as const));50// eslint-disable-next-line @typescript-eslint/no-empty-function51expectError(await getOneMessage({filter(message: Message) {}} as const));52expectError(await getOneMessage({filter: (message: Message<'json'>) => true} as const));53expectError(await getOneMessage({filter: (message: '') => true} as const));54expectError(await getOneMessage({filter: true} as const));55expectError(await getOneMessage({unknownOption: true} as const));
modified:test-d/ipc/send.test-d.ts+6 added-5 removed
4 unmodified lines
5 type Message,6 type Options,7} from '../../index.js';89const subprocess = execa('test', {ipc: true});10expectType<void>(await subprocess.sendMessage(''));11expectType<Promise<void>>(sendMessage(''));1213expectError(await subprocess.sendMessage());14expectError(await sendMessage());15expectError(await subprocess.sendMessage(undefined));16expectError(await sendMessage(undefined));17expectError(await subprocess.sendMessage(0n));18expectError(await sendMessage(0n));19expectError(await subprocess.sendMessage(Symbol('test')));20expectError(await sendMessage(Symbol('test')));2116const subprocess = execa('test', {ipc: true});17expectType<void>(await subprocess.sendMessage(''));1819expectError(await subprocess.sendMessage());2022await execa('test', {ipcInput: ''}).sendMessage('');23await execa('test', {ipcInput: '' as Message}).sendMessage('');24await execa('test', {} as Options).sendMessage?.('');25await execa('test', {ipc: true as boolean}).sendMessage?.('');
7 unmodified lines
modified:types/ipc.d.ts+14 added-2 removed
24 unmodified lines
25export type Message<26 Serialization extends Options['serialization'] = Options['serialization'],27> = Serialization extends 'json' ? JsonMessage : AdvancedMessage;2829/**30Options to `getOneMessage()` and `subprocess.getOneMessage()`31*/32type GetOneMessageOptions<33 Serialization extends Options['serialization'],34> = {35 /**36 Ignore any `message` that returns `false`.37 */38 readonly filter?: (message: Message<Serialization>) => boolean;39};4041// IPC methods in subprocess42/**43Send a `message` to the parent process.44
5 unmodified lines
50Receive a single `message` from the parent process.5152This requires the `ipc` option to be `true`. The type of `message` depends on the `serialization` option.53*/42export function getOneMessage(): Promise<Message>;54export function getOneMessage(getOneMessageOptions?: GetOneMessageOptions<Options['serialization']>): Promise<Message>;5556/**57Iterate over each `message` from the parent process.58
18 unmodified lines
77 Receive a single `message` from the subprocess.7879 This requires the `ipc` option to be `true`. The type of `message` depends on the `serialization` option.80 */69 getOneMessage(): Promise<Message<Serialization>>;81 getOneMessage(getOneMessageOptions?: GetOneMessageOptions<Serialization>): Promise<Message<Serialization>>;8283 /**84 Iterate over each `message` from the subprocess.85
29 unmodified lines