Skip to content

「captureRejections」property works different in node REPL with node file.js #41391

@Scared-Heart

Description

@Scared-Heart

Version

v15.0.1

Platform

19.5.0 Darwin Kernel Version 19.5.0

Subsystem

No response

What steps will reproduce the bug?

create a js file with the code blow

const emitter = require('events')
const em1 = new emitter({ captureRejections: true })
console.log(em1)

run node file.js
output

[Symbol(kCapture)]: true

as expected.
however then i run with node REPL
output

[Symbol(kCapture)]: false

not expected

How often does it reproduce? Is there a required condition?

always

What is the expected behavior?

captureRejections in node REPL works fine

What do you see instead?

same code
REPL output:

EventEmitter {
  _events: [Object: null prototype] {},
  _eventsCount: 0,
  _maxListeners: undefined,
  [Symbol(kCapture)]: false
}

node file.js output

EventEmitter {
  _events: [Object: null prototype] {},
  _eventsCount: 0,
  _maxListeners: undefined,
  [Symbol(kCapture)]: true
}

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.replIssues and PRs related to the REPL subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions