methods.js
This file
Path
lib/ipc/methods.js
50 lines · 1.3 KiB · JavaScript
Last changed by
Update dev dependencies (#1257)Sindre Sorhusbefore adoption5944b2d
History of this fileTake it
Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
lines 1–4why, one step back1import process from 'node:process';2import {sendMessage} from './send.js';3import {getOneMessage} from './get-one.js';4import {getEachMessage} from './get-each.js';Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5
line 5why, one step back5import {getCancelSignal} from './graceful.js';Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
lines 6–7why, one step back67// Add promise-based IPC methods in current processAdd `nodeChildProcess` to subprocess promises and make the subprocess a normal promise (#1255)Sindre Sorhusbefore adoptionade74bf
lines 8–9why, one step back8export const addIpcMethods = (target, subprocess, {ipc}) => {9 Object.assign(target, getIpcMethods(subprocess, false, ipc, target));Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
lines 10–12why, one step back10};1112// Get promise-based IPC in the subprocessAdd `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5
lines 13–15why, one step back13export const getIpcExport = () => {14 const anyProcess = process;15 const isSubprocess = true;Update dev dependencies (#1257)Sindre Sorhusbefore adoption5944b2d
line 16why, one step back16 const isIpc = process.channel !== undefined;Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5
lines 17–18why, one step back1718 return {Update dev dependencies (#1257)Sindre Sorhusbefore adoption5944b2d
line 19why, one step back19 ...getIpcMethods(anyProcess, isSubprocess, isIpc),Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5
lines 20–23why, one step back20 getCancelSignal: getCancelSignal.bind(undefined, {21 anyProcess,22 channel: anyProcess.channel,23 isSubprocess,Update dev dependencies (#1257)Sindre Sorhusbefore adoption5944b2d
line 24why, one step back24 ipc: isIpc,Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5
lines 25–27why, one step back25 }),26 };27};Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68
lines 28–29why, one step back2829// Retrieve the `ipc` shared by both the current process and the subprocessAdd `nodeChildProcess` to subprocess promises and make the subprocess a normal promise (#1255)Sindre Sorhusbefore adoptionade74bf
line 30why, one step back30const getIpcMethods = (anyProcess, isSubprocess, ipc, waitProcess = anyProcess) => ({Add tests for I/O errors during `sendMessage()` (#1095)ehmickybefore adoptionc6c66da
lines 31–32why, one step back31 sendMessage: sendMessage.bind(undefined, {32 anyProcess,Add `strict` option to `sendMessage()` (#1098)ehmickybefore adoptione085b10
line 33why, one step back33 channel: anyProcess.channel,Add tests for I/O errors during `sendMessage()` (#1095)ehmickybefore adoptionc6c66da
lines 34–47why, one step back34 isSubprocess,35 ipc,36 }),37 getOneMessage: getOneMessage.bind(undefined, {38 anyProcess,39 channel: anyProcess.channel,40 isSubprocess,41 ipc,42 }),43 getEachMessage: getEachMessage.bind(undefined, {44 anyProcess,45 channel: anyProcess.channel,46 isSubprocess,47 ipc,Add `nodeChildProcess` to subprocess promises and make the subprocess a normal promise (#1255)Sindre Sorhusbefore adoptionade74bf
line 48why, one step back48 waitProcess,Add tests for I/O errors during `sendMessage()` (#1095)ehmickybefore adoptionc6c66da
lines 49–50why, one step back49 }),50});