-
-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove file descriptor restriction on the stdin
/stdout
/stderr
option
#617
Comments
stdin
/stdout
/stderr
optionstdin
/stdout
/stderr
option
I prefer to put minimal effort into legacy APIs like Node.js streams. So my preference would be documentation:
|
Yes, I was also thinking along those lines, for the same reason. 👍 |
When adding support for passing multiple values to the For example, We can document this workaround as it might help some users (done at #644). |
Node.js requires the streams passed to the
stdio
option to have an underlying file descriptor.https://github.com/nodejs/node/blob/0afe731d357d4df9a65aeb06429bf663d8dc2975/lib/internal/child_process.js#L1060
https://github.com/nodejs/node/blob/0afe731d357d4df9a65aeb06429bf663d8dc2975/lib/internal/child_process.js#L340
Execa could remove that restriction: if a stream without a file descriptor is passed to the
stdio
option(s), we could pipe it to the child process after it spawned. This would re-use the code that does the same thing for web streams (#615).This was actually already discussed in #81, although in different terms.
However, Node.js detects whether there is an underlying file descriptor using the undocumented
stream._handle
andstream.handle
properties. Also, those must be instances ofPipe
,TTY
,TCP
orUDP
which are internal classes not accessible userland. I do not think we should build detection logic based on this, as any Node.js release might break it.Alternatively, we could make users opt-in to that behavior. For example, wrapping the stream into an array or a plain object instead of passing
stream
directly, to thestdio
option(s).Or, users could turn the Node.js stream into a web stream which we now support (#603), using
Readable.toWeb()
/Writable.toWeb()
. I.e. we would just add some documentation about this.What are your thoughts on this @sindresorhus?
The text was updated successfully, but these errors were encountered: