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

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

Closed
Scared-Heart opened this issue Jan 4, 2022 · 2 comments · Fixed by #41414
Closed
Labels
confirmed-bug Issues with confirmed bugs. repl Issues and PRs related to the REPL subsystem.

Comments

@Scared-Heart
Copy link

Scared-Heart commented Jan 4, 2022

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

@Scared-Heart Scared-Heart changed the title node REPL works different with node file.js 「captureRejections」property works different in node REPL and node file.js Jan 4, 2022
@Scared-Heart Scared-Heart changed the title 「captureRejections」property works different in node REPL and node file.js 「captureRejections」property works different in node REPL with node file.js Jan 4, 2022
@Scared-Heart
Copy link
Author

@cspotcode
Copy link

This bug is triggered by require('repl'), it does not require a REPL to be created. It is a side-effect of require('repl'), which means it can reproduce without running in the REPL.

@ZYSzys ZYSzys added confirmed-bug Issues with confirmed bugs. repl Issues and PRs related to the REPL subsystem. labels Jan 4, 2022
nodejs-github-bot pushed a commit that referenced this issue Jan 19, 2022
PR-URL: #41414
Fixes: #41391
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
BethGriggs pushed a commit that referenced this issue Jan 25, 2022
PR-URL: #41414
Fixes: #41391
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Linkgoron pushed a commit to Linkgoron/node that referenced this issue Jan 31, 2022
PR-URL: nodejs#41414
Fixes: nodejs#41391
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this issue Feb 26, 2022
PR-URL: #41414
Fixes: #41391
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this issue Mar 3, 2022
PR-URL: #41414
Fixes: #41391
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this issue Mar 14, 2022
PR-URL: #41414
Fixes: #41391
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@cspotcode @ZYSzys @Scared-Heart and others