Skip to content

Commit fe1fea6

Browse files
sigma-zer0oyyd
authored andcommitted
fix: replace the deprecated "repl.cli" with "repl"
"REPLServer.rli" is deprecated and it's the reference of the instance. So that we can replace the "repl.cli" with "repl" to remove the deprecation warning in Node.js 12. Refs: nodejs/node#26260
1 parent 5def329 commit fe1fea6

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

lib/_inspect.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class NodeInspector {
198198

199199
suspendReplWhile(fn) {
200200
if (this.repl) {
201-
this.repl.rli.pause();
201+
this.repl.pause();
202202
}
203203
this.stdin.pause();
204204
this.paused = true;
@@ -207,7 +207,7 @@ class NodeInspector {
207207
}).then(() => {
208208
this.paused = false;
209209
if (this.repl) {
210-
this.repl.rli.resume();
210+
this.repl.resume();
211211
this.repl.displayPrompt();
212212
}
213213
this.stdin.resume();

lib/internal/inspect_repl.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -958,38 +958,38 @@ function createRepl(inspector) {
958958

959959
get repl() {
960960
// Don't display any default messages
961-
const listeners = repl.rli.listeners('SIGINT').slice(0);
962-
repl.rli.removeAllListeners('SIGINT');
961+
const listeners = repl.listeners('SIGINT').slice(0);
962+
repl.removeAllListeners('SIGINT');
963963

964964
const oldContext = repl.context;
965965

966966
exitDebugRepl = () => {
967967
// Restore all listeners
968968
process.nextTick(() => {
969969
listeners.forEach((listener) => {
970-
repl.rli.on('SIGINT', listener);
970+
repl.on('SIGINT', listener);
971971
});
972972
});
973973

974974
// Exit debug repl
975975
repl.eval = controlEval;
976976

977977
// Swap history
978-
history.debug = repl.rli.history;
979-
repl.rli.history = history.control;
978+
history.debug = repl.history;
979+
repl.history = history.control;
980980

981981
repl.context = oldContext;
982-
repl.rli.setPrompt('debug> ');
982+
repl.setPrompt('debug> ');
983983
repl.displayPrompt();
984984

985-
repl.rli.removeListener('SIGINT', exitDebugRepl);
985+
repl.removeListener('SIGINT', exitDebugRepl);
986986
repl.removeListener('exit', exitDebugRepl);
987987

988988
exitDebugRepl = null;
989989
};
990990

991991
// Exit debug repl on SIGINT
992-
repl.rli.on('SIGINT', exitDebugRepl);
992+
repl.on('SIGINT', exitDebugRepl);
993993

994994
// Exit debug repl on repl exit
995995
repl.on('exit', exitDebugRepl);
@@ -999,10 +999,10 @@ function createRepl(inspector) {
999999
repl.context = {};
10001000

10011001
// Swap history
1002-
history.control = repl.rli.history;
1003-
repl.rli.history = history.debug;
1002+
history.control = repl.history;
1003+
repl.history = history.debug;
10041004

1005-
repl.rli.setPrompt('> ');
1005+
repl.setPrompt('> ');
10061006

10071007
print('Press Ctrl + C to leave debug repl');
10081008
repl.displayPrompt();
@@ -1077,7 +1077,7 @@ function createRepl(inspector) {
10771077

10781078
repl.defineCommand('interrupt', () => {
10791079
// We want this for testing purposes where sending CTRL-C can be tricky.
1080-
repl.rli.emit('SIGINT');
1080+
repl.emit('SIGINT');
10811081
});
10821082

10831083
// Init once for the initial connection

0 commit comments

Comments
 (0)