Skip to content

input option does not work with fast processes #474

@ehmicky

Description

@ehmicky

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 nodejs/node#40085

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions