From 2273971a696cccd11f9636710301f4cd3cd23bd8 Mon Sep 17 00:00:00 2001 From: Arve Seljebu Date: Sat, 7 May 2016 09:53:05 +0200 Subject: [PATCH] doc: readline.emitKeypressEvents and raw mode `readline.emitKeypressEvents` needs `stream` to be in raw mode. PR-URL: https://github.com/nodejs/node/pull/6628 Fixes: https://github.com/nodejs/node/issues/6626 Reviewed-By: Anna Henningsen Reviewed-By: Roman Klauke --- doc/api/readline.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/api/readline.md b/doc/api/readline.md index c75054dd2ee851..86deccac73e209 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -362,6 +362,15 @@ Move cursor to the specified position in a given TTY stream. Causes `stream` to begin emitting `'keypress'` events corresponding to its input. +Note that the stream, if it is a TTY, needs to be in raw mode: +```js +readline.emitKeypressEvents(process.stdin); +if (process.stdin.isTTY) { + // might not be a TTY if spawned from another node process + process.stdin.setRawMode(true); +} +``` + ## readline.moveCursor(stream, dx, dy) Move cursor relative to it's current position in a given TTY stream.