Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Should Stream.pipe() call resume() automatically? (Maybe just for stdin?) #3503

@isaacs

Description

@isaacs

It would be nice if this:

process.stdin.pipe(process.stdout);

were equivalent to cat. However, since stdin starts out in a paused state, this does nothing, and you have to do:

process.stdin.pipe(process.stdout);
process.stdin.resume();

which is 100% more lines of code. I find that rather objectionable.

Options:

  1. Stream.prototype.pipe should call this.resume() after setting up the destination. This would be the fix for other streams exhibiting the same problem, but would have much further reaching side effects. I'm very wary about doing this for 0.8, but it could be explored for 0.9.
  2. process.stdin.pipe should call this.resume() after applying Stream.prototype.pipe. This would be the surgical fix, but is perhaps still too hazardous to do now for 0.8 without exploring edge cases.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions