Skip to content

Writeable stream .end() has paradoxical logic #5540

@ronkorving

Description

@ronkorving
  • Version: 5.7.1
  • Platform: all
  • Subsystem: streams

It says here to ignore unnecessary end() calls. That means callbacks will not fire, even though end() is called. Should it not instead return either an error to the callback, or act as a noop before calling cb? The irony is that endWritable itself seems to act exactly like it may be called multiple times.

So which should it be? Right now, it seems like we have 2 different pieces of reasoning in the same class, and one simply overrules the other. Imho, we should get rid of one, and in my opinion, it should be the "ignore unnecessary end() calls" one, because when people pass a callback, they expect it to be called.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionIssues that look for answers.streamIssues and PRs related to the stream subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions