summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/js/40_files.js5
-rw-r--r--runtime/js/40_tty.js6
-rw-r--r--runtime/js/90_deno_ns.js1
-rw-r--r--runtime/ops/tty.rs9
4 files changed, 10 insertions, 11 deletions
diff --git a/runtime/js/40_files.js b/runtime/js/40_files.js
index a2afdb09d..c864d3970 100644
--- a/runtime/js/40_files.js
+++ b/runtime/js/40_files.js
@@ -181,6 +181,11 @@
}
return this.#readable;
}
+
+ setRaw(mode, options = {}) {
+ const cbreak = !!(options.cbreak ?? false);
+ ops.op_stdin_set_raw(mode, cbreak);
+ }
}
class Stdout {
diff --git a/runtime/js/40_tty.js b/runtime/js/40_tty.js
index f43859ed7..be5154fa2 100644
--- a/runtime/js/40_tty.js
+++ b/runtime/js/40_tty.js
@@ -21,14 +21,8 @@
return !!isattyBuffer[0];
}
- const DEFAULT_CBREAK = false;
- function setRaw(rid, mode, options = {}) {
- ops.op_set_raw(rid, mode, options.cbreak || DEFAULT_CBREAK);
- }
-
window.__bootstrap.tty = {
consoleSize,
isatty,
- setRaw,
};
})(this);
diff --git a/runtime/js/90_deno_ns.js b/runtime/js/90_deno_ns.js
index e7b21640a..33b5d531a 100644
--- a/runtime/js/90_deno_ns.js
+++ b/runtime/js/90_deno_ns.js
@@ -117,7 +117,6 @@
};
__bootstrap.denoNsUnstable = {
- setRaw: __bootstrap.tty.setRaw,
consoleSize: __bootstrap.tty.consoleSize,
DiagnosticCategory: __bootstrap.diagnostics.DiagnosticCategory,
loadavg: __bootstrap.os.loadavg,
diff --git a/runtime/ops/tty.rs b/runtime/ops/tty.rs
index e267fc07f..07c636e99 100644
--- a/runtime/ops/tty.rs
+++ b/runtime/ops/tty.rs
@@ -40,7 +40,7 @@ fn get_windows_handle(
pub fn init() -> Extension {
Extension::builder()
.ops(vec![
- op_set_raw::decl(),
+ op_stdin_set_raw::decl(),
op_isatty::decl(),
op_console_size::decl(),
])
@@ -48,13 +48,14 @@ pub fn init() -> Extension {
}
#[op(fast)]
-fn op_set_raw(
+fn op_stdin_set_raw(
state: &mut OpState,
- rid: u32,
is_raw: bool,
cbreak: bool,
) -> Result<(), AnyError> {
- super::check_unstable(state, "Deno.setRaw");
+ super::check_unstable(state, "Deno.stdin.setRaw");
+
+ let rid = 0; // stdin is always rid=0
// From https://github.com/kkawakam/rustyline/blob/master/src/tty/windows.rs
// and https://github.com/kkawakam/rustyline/blob/master/src/tty/unix.rs