-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
Closed as not planned
Labels
child_processIssues and PRs related to the child_process subsystem.Issues and PRs related to the child_process subsystem.
Description
Version
16.7.0 (changelog)
Platform
Linux ether-laptop 5.11.0-34-generic #36-Ubuntu SMP Thu Aug 26 19:22:09 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
child_process
What steps will reproduce the bug?
import { spawn } from 'child_process'
const childProcess = spawn('echo')
childProcess.stdin.end('test')
How often does it reproduce? Is there a required condition?
With Node <=16.6.0
, this creates no error.
Also, this only produces an error with specific binaries. echo
does produce the error, but cat
or node --version
do not.
Finally, this seems to happen on macOS and Linux, but not on Windows.
What is the expected behavior?
No error should be produced.
Also, test
should be written to the child process's stdin
. Some modules like Execa rely on being able to pass a string or buffer to a child process's stdin (upstream issue for Execa: sindresorhus/execa#474).
What do you see instead?
With Node >=16.7.0
, this produces:
node:events:371
throw er; // Unhandled 'error' event
^
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 file:///myfile.js:4:20
at ModuleJob.run (node:internal/modules/esm/module_job:183:25)
Emitted 'error' event on Socket instance at:
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -32,
code: 'EPIPE',
syscall: 'write'
}
sindresorhus, jopemachine, DanielRamosAcosta, sidwebworks, xmedeko and 1 more
Metadata
Metadata
Assignees
Labels
child_processIssues and PRs related to the child_process subsystem.Issues and PRs related to the child_process subsystem.