| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 23d2c54 commit e739196
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -651,7 +651,7 @@ function REPLServer(prompt, | |||
| 651 | 651 | errStack = self.writer(e); | |
| 652 | 652 | ||
| 653 | 653 | // Remove one line error braces to keep the old style in place. | |
| 654 | - if (errStack[errStack.length - 1] === ']') { | ||
| 654 | + if (errStack[0] === '[' && errStack[errStack.length - 1] === ']') { | ||
| 655 | 655 | errStack = StringPrototypeSlice(errStack, 1, -1); | |
| 656 | 656 | } | |
| 657 | 657 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,23 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + require('../common'); | ||
| 3 | + const { PassThrough } = require('stream'); | ||
| 4 | + const assert = require('assert'); | ||
| 5 | + const repl = require('repl'); | ||
| 6 | + | ||
| 7 | + { | ||
| 8 | + const input = new PassThrough(); | ||
| 9 | + const output = new PassThrough(); | ||
| 10 | + | ||
| 11 | + const r = repl.start({ | ||
| 12 | + prompt: '', | ||
| 13 | + input, | ||
| 14 | + output, | ||
| 15 | + writer: String, | ||
| 16 | + terminal: false, | ||
| 17 | + useColors: false | ||
| 18 | + }); | ||
| 19 | + | ||
| 20 | + r.write('throw new Error("foo[a]")\n'); | ||
| 21 | + r.close(); | ||
| 22 | + assert.strictEqual(output.read().toString(), 'Uncaught Error: foo[a]\n'); | ||
| 23 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments