summaryrefslogtreecommitdiff
path: root/test/pseudo-tty/repl-dumb-tty.js
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2019-08-15 12:37:29 -0400
committercjihrig <cjihrig@gmail.com>2019-08-17 15:49:45 -0400
commit93b341ed01a735f671c84e72a30e5e55945ea27f (patch)
tree1a1b8973caf3e806856f25e95b0f9614ec0f3067 /test/pseudo-tty/repl-dumb-tty.js
parenta5edceea0416ad911ffdbc9b6a93eb3630d1a550 (diff)
downloadandroid-node-v8-93b341ed01a735f671c84e72a30e5e55945ea27f.tar.gz
android-node-v8-93b341ed01a735f671c84e72a30e5e55945ea27f.tar.bz2
android-node-v8-93b341ed01a735f671c84e72a30e5e55945ea27f.zip
readline: close dumb terminals on Control+D
This commit adds support for closing a readline interface on Control+D when the terminal is dumb. PR-URL: https://github.com/nodejs/node/pull/29149 Fixes: https://github.com/nodejs/node/issues/29111 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'test/pseudo-tty/repl-dumb-tty.js')
-rw-r--r--test/pseudo-tty/repl-dumb-tty.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/test/pseudo-tty/repl-dumb-tty.js b/test/pseudo-tty/repl-dumb-tty.js
index 08c63881d3..1a3a242998 100644
--- a/test/pseudo-tty/repl-dumb-tty.js
+++ b/test/pseudo-tty/repl-dumb-tty.js
@@ -1,9 +1,10 @@
'use strict';
-require('../common');
+const common = require('../common');
process.env.TERM = 'dumb';
const repl = require('repl');
+const ArrayStream = require('../common/arraystream');
repl.start('> ');
process.stdin.push('console.log("foo")\n');
@@ -13,3 +14,18 @@ process.stdin.push('console.dir({ a: 1 })\n');
process.stdin.push('{ a: 1 }\n');
process.stdin.push('\n');
process.stdin.push('.exit\n');
+
+// Verify Control+D support.
+{
+ const stream = new ArrayStream();
+ const replServer = repl.start({
+ prompt: '> ',
+ terminal: true,
+ input: stream,
+ output: stream,
+ useColors: false
+ });
+
+ replServer.on('close', common.mustCall());
+ replServer.write(null, { ctrl: true, name: 'd' });
+}