-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When create a nest repl, will register `Runtime.executionContextCreated` listener to the inspector session.This patch will fix listener repeatedly register. PR-URL: #18881 Fixes: #18284 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
- Loading branch information
Showing
2 changed files
with
23 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
const repl = require('repl'); | ||
const DEFAULT_MAX_LISTENERS = require('events').defaultMaxListeners; | ||
|
||
common.ArrayStream.prototype.write = () => { | ||
}; | ||
|
||
const putIn = new common.ArrayStream(); | ||
const testMe = repl.start('', putIn); | ||
|
||
// https://github.com/nodejs/node/issues/18284 | ||
// Tab-completion should not repeatedly add the | ||
// `Runtime.executionContextCreated` listener | ||
process.on('warning', common.mustNotCall()); | ||
|
||
putIn.run(['.clear']); | ||
putIn.run(['async function test() {']); | ||
for (let i = 0; i < DEFAULT_MAX_LISTENERS; i++) { | ||
testMe.complete('await Promise.resolve()', () => {}); | ||
} |