Skip to content

Unclosable Streams #92

Open
Open
@Aidan63

Description

@Aidan63

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions