| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b4f4c24 commit ce391ed
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,7 +27,7 @@ const Stream = require('stream'); | |||
| 27 | 27 | const vm = require('vm'); | |
| 28 | 28 | const path = require('path'); | |
| 29 | 29 | const fs = require('fs'); | |
| 30 | - const rl = require('readline'); | ||
| 30 | + const Interface = require('readline').Interface; | ||
| 31 | 31 | const Console = require('console').Console; | |
| 32 | 32 | const domain = require('domain'); | |
| 33 | 33 | const debug = util.debuglog('repl'); | |
@@ -229,7 +229,7 @@ function REPLServer(prompt, | |||
| 229 | 229 | self.complete(text, callback); | |
| 230 | 230 | } | |
| 231 | 231 | ||
| 232 | - rl.Interface.call(this, { | ||
| 232 | + Interface.call(this, { | ||
| 233 | 233 | input: self.inputStream, | |
| 234 | 234 | output: self.outputStream, | |
| 235 | 235 | completer: complete, | |
@@ -453,7 +453,7 @@ function REPLServer(prompt, | |||
| 453 | 453 | ||
| 454 | 454 | self.displayPrompt(); | |
| 455 | 455 | } | |
| 456 | - inherits(REPLServer, rl.Interface); | ||
| 456 | + inherits(REPLServer, Interface); | ||
| 457 | 457 | exports.REPLServer = REPLServer; | |
| 458 | 458 | ||
| 459 | 459 | exports.REPL_MODE_SLOPPY = Symbol('repl-sloppy'); | |
@@ -479,6 +479,20 @@ exports.start = function(prompt, | |||
| 479 | 479 | return repl; | |
| 480 | 480 | }; | |
| 481 | 481 | ||
| 482 | + REPLServer.prototype.close = function replClose() { | ||
| 483 | + if (this.terminal && this._flushing && !this._closingOnFlush) { | ||
| 484 | + this._closingOnFlush = true; | ||
| 485 | + this.once('flushHistory', () => | ||
| 486 | + Interface.prototype.close.call(this) | ||
| 487 | + ); | ||
| 488 | + | ||
| 489 | + return; | ||
| 490 | + } | ||
| 491 | + process.nextTick(() => | ||
| 492 | + Interface.prototype.close.call(this) | ||
| 493 | + ); | ||
| 494 | + }; | ||
| 495 | + | ||
| 482 | 496 | REPLServer.prototype.createContext = function() { | |
| 483 | 497 | var context; | |
| 484 | 498 | if (this.useGlobal) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments