execa: `input` option does not work with fast processes
This can be reproduced with:
execa('echo', { input: 'test' })
node:internal/process/promises:246
triggerUncaughtException(err, true /* fromPromise */);
^
Error: write EPIPE
at afterWriteDispatched (node:internal/stream_base_commons:164:15)
at writeGeneric (node:internal/stream_base_commons:155:3)
at Socket._writeGeneric (node:net:780:11)
at Socket._write (node:net:792:8)
at writeOrBuffer (node:internal/streams/writable:389:12)
at _write (node:internal/streams/writable:330:10)
at Socket.Writable.end (node:internal/streams/writable:609:17)
at Socket.end (node:net:594:31)
at handleInput (/home/ether/code/nve/node_modules/execa/lib/stream.js:17:17)
at execa (/home/ether/code/nve/node_modules/execa/index.js:156:2) {
errno: -32,
code: 'EPIPE',
syscall: 'write'
}
This happens when the child process is too fast to finish. When this happens, Execa writes to the process stdin
while it has already ended, which creates an EPIPE
error.
Discussion about this happening at https://github.com/nodejs/node/issues/40085
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 16 (6 by maintainers)
I agree. A temporary file seems like the safest as there are a lot of unknowns with the other solutions.