From efe7cccd9c41f1823048b42f7a96db0c3081b534 Mon Sep 17 00:00:00 2001 From: Arve Seljebu Date: Sat, 7 May 2016 09:53:05 +0200 Subject: [PATCH] expand documentation for readline.emitKeypressEvents `readline.emitKeypressEvents` needs `stream` to be in raw mode, ref #6626 --- 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.