Skip to content
Myr

Refactor file descriptor-related logic (#861)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by ehmicky · committed by GitHub · parent 295ef40 · Browse files · 3 files+8 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+8 added−5 removed

  • other:+8 added−5 removed

3 files+8 added−5 removed

modified:lib/stdio/direction.js+1 added-1 removed
modified:lib/stream/resolve.js+3 added-3 removed
modified:lib/stream/wait.js+4 added-1 removed
44 unmodified lines
45// For example, `childProcess.stdin` is technically a Duplex, but can only be used as a writable.46// Therefore, we need to use the file descriptor's direction (`stdin` is input, `stdout` is output, etc.).47// However, while `childProcess.std*` and transforms follow that direction, any stream passed the `std*` option has the opposite direction.48// For example, `childProcess.stdin` is a writable, but the `stdin` option is a readable.49export const isInputFileDescriptor = (fdNumber, stdioStreamsGroups) => stdioStreamsGroups[fdNumber][0].direction === 'input';49export const isInputFileDescriptor = (fdNumber, stdioStreamsGroups) => {50 const [{direction}] = stdioStreamsGroups.find(stdioStreams => stdioStreams[0].fdNumber === fdNumber);51 return direction === 'input';52};5354// When `stream.destroy()` is called without an `error` argument, stream is aborted.55// This is the only way to abort a readable stream, which can be useful in some instances.56// Therefore, we ignore this error on readable streams.
8 unmodified lines