Better error message on IPC EPIPE by ehmicky · Pull Request #1088 · sindresorhus/execa (original) (raw)
When sendMessage() is sent exactly:
- After the subprocess has started disconnecting
- But before it has emitted the
disconnectevent, setsubprocess.connected falsenor setsubprocess.channel null
Then an EPIPE error is emitted.
Error: write EPIPE
at target._send (node:internal/child_process:879:20)
at target.send (node:internal/child_process:752:19)
at node:internal/util:430:21
at new Promise (<anonymous>)
at bound (node:internal/util:416:12)
at ...
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
errno: -32,
code: 'EPIPE',
syscall: 'write'
}
This PR provides with a better error message instead:
Error: subprocess.sendMessage() cannot be used: the subprocess is disconnecting.
at ...
[cause]: Error: write EPIPE
at target._send (node:internal/child_process:879:20)
at target.send (node:internal/child_process:752:19)
at node:internal/util:430:21
at new Promise (<anonymous>)
at bound (node:internal/util:416:12)
at ...
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
errno: -32,
code: 'EPIPE',
syscall: 'write'
}
}