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.