Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const Stream = require('stream');
const vm = require('vm');
const path = require('path');
const fs = require('fs');
const rl = require('readline');
const Interface = require('readline').Interface;
const Console = require('console').Console;
const domain = require('domain');
const debug = util.debuglog('repl');
Expand Down Expand Up @@ -229,7 +229,7 @@ function REPLServer(prompt,
self.complete(text, callback);
}

rl.Interface.call(this, {
Interface.call(this, {
input: self.inputStream,
output: self.outputStream,
completer: complete,
Expand Down Expand Up @@ -453,7 +453,7 @@ function REPLServer(prompt,

self.displayPrompt();
}
inherits(REPLServer, rl.Interface);
inherits(REPLServer, Interface);
exports.REPLServer = REPLServer;

exports.REPL_MODE_SLOPPY = Symbol('repl-sloppy');
Expand All @@ -479,6 +479,20 @@ exports.start = function(prompt,
return repl;
};

REPLServer.prototype.close = function replClose() {
if (this.terminal && this._flushing && !this._closingOnFlush) {
this._closingOnFlush = true;
this.once('flushHistory', () =>
Interface.prototype.close.call(this)
);

return;
}
process.nextTick(() =>
Interface.prototype.close.call(this)
);
};

REPLServer.prototype.createContext = function() {
var context;
if (this.useGlobal) {
Expand Down