diff options
author | killagu <killa123@126.com> | 2018-02-20 20:12:58 +0800 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-02-22 15:07:05 +0000 |
commit | 26231548ad1dff971cdeaab3085b372a75ad1efb (patch) | |
tree | 6107af84bc4179cc85e67af18583e8aa07b678de /lib | |
parent | 51be03cd577fe8b5a73dd9558bd6a2727f9c3c0b (diff) | |
download | android-node-v8-26231548ad1dff971cdeaab3085b372a75ad1efb.tar.gz android-node-v8-26231548ad1dff971cdeaab3085b372a75ad1efb.tar.bz2 android-node-v8-26231548ad1dff971cdeaab3085b372a75ad1efb.zip |
repl: fix tab-complete warning
When create a nest repl, will register `Runtime.executionContextCreated`
listener to the inspector session.This patch will fix listener
repeatedly register.
PR-URL: https://github.com/nodejs/node/pull/18881
Fixes: https://github.com/nodejs/node/issues/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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/repl.js | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/repl.js b/lib/repl.js index bd41ecdccf..8201630c3a 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -753,7 +753,7 @@ REPLServer.prototype.createContext = function() { } else { sendInspectorCommand((session) => { session.post('Runtime.enable'); - session.on('Runtime.executionContextCreated', ({ params }) => { + session.once('Runtime.executionContextCreated', ({ params }) => { this[kContextId] = params.context.id; }); context = vm.createContext(); @@ -937,7 +937,6 @@ function complete(line, callback) { var flat = new ArrayStream(); // make a new "input" stream var magic = new REPLServer('', flat); // make a nested REPL replMap.set(magic, replMap.get(this)); - magic.resetContext(); flat.run(tmp); // eval the flattened code // all this is only profitable if the nested REPL // does not have a bufferedCommand |