summaryrefslogtreecommitdiff
path: root/cli/js/tty.ts
diff options
context:
space:
mode:
authorKevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com>2020-02-25 22:01:24 -0800
committerGitHub <noreply@github.com>2020-02-26 01:01:24 -0500
commit5946808f66aab1983ade3db2541734bb43626a72 (patch)
treeadb526497a9efc29d1b5744ae52449f08f453ef0 /cli/js/tty.ts
parente53064c4f22efeb8a4eda2712e15c77d2699a686 (diff)
tty: Deno.setRaw(rid, mode) to turn on/off raw mode (#3958)
Diffstat (limited to 'cli/js/tty.ts')
-rw-r--r--cli/js/tty.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/cli/js/tty.ts b/cli/js/tty.ts
new file mode 100644
index 000000000..2ad44d025
--- /dev/null
+++ b/cli/js/tty.ts
@@ -0,0 +1,14 @@
+import { sendSync } from "./dispatch_json.ts";
+
+/** Check if a given resource is TTY. */
+export function isatty(rid: number): boolean {
+ return sendSync("op_isatty", { rid });
+}
+
+/** Set TTY to be under raw mode or not. */
+export function setRaw(rid: number, mode: boolean): void {
+ sendSync("op_set_raw", {
+ rid,
+ mode
+ });
+}