mirror of https://github.com/lukechilds/node.git
Browse Source
Previous behavior was to assume an error is a proper error in the repl module. A check was added to not terminate the process on thrown repl errors that are `null` or `undefined`. PR-URL: https://github.com/nodejs/node/pull/14306 Fixes: https://github.com/nodejs/node/issues/12373 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.comv6
2 changed files with 32 additions and 2 deletions
@ -0,0 +1,24 @@ |
|||
'use strict'; |
|||
require('../common'); |
|||
const repl = require('repl'); |
|||
const assert = require('assert'); |
|||
const Stream = require('stream'); |
|||
|
|||
const output = new Stream(); |
|||
let text = ''; |
|||
output.write = output.pause = output.resume = function(buf) { |
|||
text += buf.toString(); |
|||
}; |
|||
|
|||
const replserver = repl.start({ |
|||
output: output, |
|||
input: process.stdin |
|||
}); |
|||
|
|||
replserver.emit('line', 'process.nextTick(() => { throw null; })'); |
|||
replserver.emit('line', '.exit'); |
|||
|
|||
setTimeout(() => { |
|||
console.log(text); |
|||
assert(text.includes('Thrown: null')); |
|||
}, 0); |
Loading…
Reference in new issue