Skip to content
This repository has been archived by the owner on Feb 1, 2022. It is now read-only.

Commit

Permalink
Merge pull request #66 from oyyd/fix-repl-rli
Browse files Browse the repository at this point in the history
fix: replace the deprecated "repl.cli" with "repl"
  • Loading branch information
jkrems committed May 16, 2019
2 parents 5def329 + 5c1d771 commit 1d94012
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions lib/_inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class NodeInspector {

suspendReplWhile(fn) {
if (this.repl) {
this.repl.rli.pause();
this.repl.pause();
}
this.stdin.pause();
this.paused = true;
Expand All @@ -207,7 +207,7 @@ class NodeInspector {
}).then(() => {
this.paused = false;
if (this.repl) {
this.repl.rli.resume();
this.repl.resume();
this.repl.displayPrompt();
}
this.stdin.resume();
Expand Down
24 changes: 12 additions & 12 deletions lib/internal/inspect_repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -958,38 +958,38 @@ function createRepl(inspector) {

get repl() {
// Don't display any default messages
const listeners = repl.rli.listeners('SIGINT').slice(0);
repl.rli.removeAllListeners('SIGINT');
const listeners = repl.listeners('SIGINT').slice(0);
repl.removeAllListeners('SIGINT');

const oldContext = repl.context;

exitDebugRepl = () => {
// Restore all listeners
process.nextTick(() => {
listeners.forEach((listener) => {
repl.rli.on('SIGINT', listener);
repl.on('SIGINT', listener);
});
});

// Exit debug repl
repl.eval = controlEval;

// Swap history
history.debug = repl.rli.history;
repl.rli.history = history.control;
history.debug = repl.history;
repl.history = history.control;

repl.context = oldContext;
repl.rli.setPrompt('debug> ');
repl.setPrompt('debug> ');
repl.displayPrompt();

repl.rli.removeListener('SIGINT', exitDebugRepl);
repl.removeListener('SIGINT', exitDebugRepl);
repl.removeListener('exit', exitDebugRepl);

exitDebugRepl = null;
};

// Exit debug repl on SIGINT
repl.rli.on('SIGINT', exitDebugRepl);
repl.on('SIGINT', exitDebugRepl);

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

// Swap history
history.control = repl.rli.history;
repl.rli.history = history.debug;
history.control = repl.history;
repl.history = history.debug;

repl.rli.setPrompt('> ');
repl.setPrompt('> ');

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

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

// Init once for the initial connection
Expand Down

0 comments on commit 1d94012

Please sign in to comment.