Skip to content
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

Streams: readable stream does not get _construct called #36058

Closed
a0viedo opened this issue Nov 9, 2020 · 5 comments
Closed

Streams: readable stream does not get _construct called #36058

a0viedo opened this issue Nov 9, 2020 · 5 comments
Labels
stream Issues and PRs related to the stream subsystem.

Comments

@a0viedo
Copy link
Member

a0viedo commented Nov 9, 2020

  • 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

@PoojaDurgad PoojaDurgad added the stream Issues and PRs related to the stream subsystem. label Nov 10, 2020
@lpinca
Copy link
Member

lpinca commented Nov 10, 2020

The feature is not available on Node.js 14.x. I think the Added in: 14.13.1 info is incorrect.

lpinca added a commit to lpinca/node that referenced this issue Nov 10, 2020
`readable._construct()` and `writable._construct()` were added to
Node.js v15.0.0 via fb8cc72.

Fixes: nodejs#36058
@targos targos reopened this Nov 14, 2020
@targos
Copy link
Member

targos commented Nov 14, 2020

If the feature is not available on v14.x, this is still an issue because the documentation has it on that branch:
https://github.com/nodejs/node/blob/v14.x/doc/api/stream.md#readable_constructcallback
https://github.com/nodejs/node/blob/v14.x/doc/api/stream.md#writable_constructcallback

@lpinca
Copy link
Member

lpinca commented Nov 14, 2020 via email

@targos
Copy link
Member

targos commented Nov 14, 2020

That PR just changes the version number. I think we should entirely remove that feature from the documentation in v14

@lpinca
Copy link
Member

lpinca commented Nov 14, 2020

Ah yes you are right, it makes sense.

lpinca added a commit to lpinca/node that referenced this issue Nov 16, 2020
The feature was added in Node.js v15.0.0.

Fixes: nodejs#36058
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stream Issues and PRs related to the stream subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants