forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The REPL implementation would strip away the first and last character of a formatted error message if it ended with `]` (but with the obviously missing check for a starting `]`), leading to things like `Uncaught rror: foo[a` being printed for input like `Error: foo[a]`. Refs: nodejs#22436
- Loading branch information
Showing
2 changed files
with
24 additions
and
1 deletion.
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,23 @@ | ||
'use strict'; | ||
require('../common'); | ||
const { PassThrough } = require('stream'); | ||
const assert = require('assert'); | ||
const repl = require('repl'); | ||
|
||
{ | ||
const input = new PassThrough(); | ||
const output = new PassThrough(); | ||
|
||
const r = repl.start({ | ||
prompt: '', | ||
input, | ||
output, | ||
writer: String, | ||
terminal: false, | ||
useColors: false | ||
}); | ||
|
||
r.write(`throw new Error("foo[a]")\n`); | ||
r.close(); | ||
assert.strictEqual(output.read().toString(), 'Uncaught Error: foo[a]\n'); | ||
} |