aboutsummaryrefslogtreecommitdiff
path: root/src/js/node/readline.js
diff options
context:
space:
mode:
authorGravatar Dylan Conway <35280289+dylan-conway@users.noreply.github.com> 2023-08-19 00:11:24 -0700
committerGravatar GitHub <noreply@github.com> 2023-08-19 00:11:24 -0700
commitdb09ed15fd561b89b24b979b986e21a04576f7cc (patch)
treeafe32e4eccaf1fe3f2f4cd536c1f2a61efad28c1 /src/js/node/readline.js
parentbf517d9f8e993a9ed3a02d21094c3ce76d7953a1 (diff)
downloadbun-db09ed15fd561b89b24b979b986e21a04576f7cc.tar.gz
bun-db09ed15fd561b89b24b979b986e21a04576f7cc.tar.zst
bun-db09ed15fd561b89b24b979b986e21a04576f7cc.zip
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
Diffstat (limited to 'src/js/node/readline.js')
-rw-r--r--src/js/node/readline.js16
1 files changed, 7 insertions, 9 deletions
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;
}