Skip to content

Streams: readable stream does not get _construct called #36058

@a0viedo

Description

@a0viedo
  • Version: v14.15.0
  • Platform: Linux
  • Subsystem: streams

What steps will reproduce the bug?

const { Readable } = require('stream');
class ReadStream extends Readable {
  constructor() {
    super();
  }
  _construct(cb) {
      console.log('_construct called');
      cb();
  }
  _read(n) {
  }
}

(new ReadStream()).on('data', ()=>{});

If I run the above with v14.15.0 nothing gets printed but on v15.0.1 I get "_construct called".

How often does it reproduce?

Always

What is the expected behavior?

_construct should be called

What do you see instead?

_construct is not called

Additional information

According to the docs this was added on v14.13.1
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    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