-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
repl: don't terminate on null thrown
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: #14306 Fixes: #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.com
- Loading branch information
Benjamin Gruenbaum
committed
Jul 19, 2017
1 parent
0e5283b
commit 030a028
Showing
2 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |