Skip to content

Document that readline.emitKeypressEvents only works when tty is in raw mode #6626

Closed
@arve0

Description

@arve0
  • Version: 6.0.0
  • Platform: osx 10.11.4, uname -a: 15.4.0 Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016; root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64
  • Subsystem: readline.emitKeypressEvents

process.stdin does not emit keypress after readline.emitKeypressEvents(process.stdin), but does when a readline interface created.

const readline = require('readline')

// const rl = readline.createInterface({
//  input: process.stdin,
//  output: process.stdout
// })
readline.emitKeypressEvents(process.stdin)
process.stdin.on('keypress', () => {
    process.stdout.write('.')
})

What happens: On keypress, event handler is not called. If a readline interface is created, the event handler is called.
Expected: stdin to start emitting keypress-events.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.readlineIssues and PRs related to the built-in readline module.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions