Skip to content

stream: Readable().removeAllListeners() not work #20923

Closed
@kaelzhang

Description

@kaelzhang
  • Version: 10.1.0, 10.2.0, 11.0.0-pre
  • Platform: Darwin (), maybe all platforms
  • Subsystem:
const {Socket} = require('net')
const s = new Socket
s.on('data', () => {
})

s.removeAllListeners()
s.listenerCount('data') // 0 expected, but got 1

If there is no arguments for stream::removeAllListeners(), the argument to be passed into Stream.prototype.removeAllListeners will be undefined, see here

The undefined value causes that the events::removeAllListeners(undefined) will do nothing. see here

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions