| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 30de036 commit aa24681
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -889,8 +889,11 @@ function REPLServer(prompt, | |||
| 889 | 889 | self.output.write(self.writer(ret) + '\n'); | |
| 890 | 890 | } | |
| 891 | 891 | ||
| 892 | - // Display prompt again | ||
| 893 | - self.displayPrompt(); | ||
| 892 | + // Display prompt again (unless we already did by emitting the 'error' | ||
| 893 | + // event on the domain instance). | ||
| 894 | + if (!e) { | ||
| 895 | + self.displayPrompt(); | ||
| 896 | + } | ||
| 894 | 897 | } | |
| 895 | 898 | }); | |
| 896 | 899 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,23 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const common = require('../common'); | ||
| 3 | + const assert = require('assert'); | ||
| 4 | + const repl = require('repl'); | ||
| 5 | + const { PassThrough } = require('stream'); | ||
| 6 | + const input = new PassThrough(); | ||
| 7 | + const output = new PassThrough(); | ||
| 8 | + | ||
| 9 | + const r = repl.start({ | ||
| 10 | + input, output, | ||
| 11 | + eval: common.mustCall((code, context, filename, cb) => { | ||
| 12 | + r.setPrompt('prompt! '); | ||
| 13 | + cb(new Error('err')); | ||
| 14 | + }) | ||
| 15 | + }); | ||
| 16 | + | ||
| 17 | + input.end('foo\n'); | ||
| 18 | + | ||
| 19 | + // The output includes exactly one post-error prompt. | ||
| 20 | + const out = output.read().toString(); | ||
| 21 | + assert.match(out, /prompt!/); | ||
| 22 | + assert.doesNotMatch(out, /prompt![\S\s]*prompt!/); | ||
| 23 | + output.on('data', common.mustNotCall()); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments