Skip to content

Unclosable Streams #92

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

Open
Aidan63 opened this issue Apr 6, 2024 · 0 comments
Open

Unclosable Streams #92

Aidan63 opened this issue Apr 6, 2024 · 0 comments
Labels

Comments

@Aidan63
Copy link
Owner

Aidan63 commented Apr 6, 2024

The IDuplex interface and friends all have a close function but the majority of the out of the box implementations of these interfaces have questionable use / implementations.

  • Closing file descriptors 0-2 (stdio) is bad for security reasons and libuv has inconcistent behaviour on different systems with this. Due to this my implementation always returns success when closing the current process stdio and doesn't call uv_close. The bigger question is why would the user actually want to close the stdout of the current process?
  • Closing the pipes of a spawned process does work, but would the user really want to do it? Assuming calling close on the ChildProcess object will automatically clean up those pipes what use cases are there for closing child process pipes early?
  • The only place close has a real purpose is sockets and servers where they close connections and stop the server respectively.
  • File operations make no use of IDuplex or related interfaces.

Considering 2 / 3 of the close implementations are questionable at best it seems like this design is wrong. Obviously there is a use for closable streams and user defined ones might have need of them, but it does seem like we need something to represent an non-closable streams as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant