From db09ed15fd561b89b24b979b986e21a04576f7cc Mon Sep 17 00:00:00 2001 From: Dylan Conway <35280289+dylan-conway@users.noreply.github.com> Date: Sat, 19 Aug 2023 00:11:24 -0700 Subject: tty `ReadStream`, `WriteStream`, and readline rawmode (#4179) * tty `WriteStream`, `ReadStream`, and rawmode * tests * refactor prototypes * fix failing test * fix test and library usage * more merge * fix child_process test * create pseudo terminal for tty tests * match node logic * handle invalid tty * close descriptors * move tests to another process * fix test again * fix test on linux --- src/js/node/readline.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/js/node/readline.js') diff --git a/src/js/node/readline.js b/src/js/node/readline.js index 0811fb95f..681cbba62 100644 --- a/src/js/node/readline.js +++ b/src/js/node/readline.js @@ -1604,15 +1604,13 @@ var _Interface = class Interface extends InterfaceConstructor { return this[kPrompt]; } - [kSetRawMode](mode) { - var input = this.input; - var { setRawMode, wasInRawMode } = input; - - // TODO: Make this work, for now just stub this and print debug - debug("setRawMode", mode, "set!"); - // if (typeof setRawMode === "function") { - // setRawMode(mode); - // } + [kSetRawMode](flag) { + const mode = flag ? 1 : 0; + const wasInRawMode = this.input.isRaw; + + if (typeof this.input.setRawMode === "function") { + this.input.setRawMode(mode); + } return wasInRawMode; } -- cgit v1.2.3