-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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 <targos@protonmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
- 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()', () => {}); | ||
} |