diff options
Diffstat (limited to 'cli')
-rw-r--r-- | cli/diagnostics.rs | 1 | ||||
-rw-r--r-- | cli/dts/lib.deno.ns.d.ts | 27 | ||||
-rw-r--r-- | cli/dts/lib.deno.unstable.d.ts | 34 | ||||
-rw-r--r-- | cli/tests/integration/run_tests.rs | 2 | ||||
-rw-r--r-- | cli/tests/testdata/run/unstable_worker.ts.out | 2 | ||||
-rw-r--r-- | cli/tests/testdata/workers/worker_unstable.ts | 2 | ||||
-rw-r--r-- | cli/tests/unit/tty_color_test.ts | 2 | ||||
-rw-r--r-- | cli/tests/unit/tty_test.ts | 2 |
8 files changed, 33 insertions, 39 deletions
diff --git a/cli/diagnostics.rs b/cli/diagnostics.rs index 6100bc9d5..c15832869 100644 --- a/cli/diagnostics.rs +++ b/cli/diagnostics.rs @@ -49,7 +49,6 @@ const UNSTABLE_DENO_PROPS: &[&str] = &[ "osRelease", "ppid", "removeSignalListener", - "setRaw", "shutdown", "Signal", "startTls", diff --git a/cli/dts/lib.deno.ns.d.ts b/cli/dts/lib.deno.ns.d.ts index 095ae139a..f3e6b1376 100644 --- a/cli/dts/lib.deno.ns.d.ts +++ b/cli/dts/lib.deno.ns.d.ts @@ -1331,6 +1331,13 @@ declare namespace Deno { readonly writable: WritableStream<Uint8Array>; } + /** **UNSTABLE**: new API, yet to be vetted. + * + * @category I/O */ + export interface SetRawOptions { + cbreak: boolean; + } + /** A handle for `stdin`. * * @category I/O @@ -1338,6 +1345,26 @@ declare namespace Deno { export const stdin: Reader & ReaderSync & Closer & { readonly rid: number; readonly readable: ReadableStream<Uint8Array>; + /** **UNSTABLE**: new API, yet to be vetted. + * + * Set TTY to be under raw mode or not. In raw mode, characters are read and + * returned as is, without being processed. All special processing of + * characters by the terminal is disabled, including echoing input + * characters. Reading from a TTY device in raw mode is faster than reading + * from a TTY device in canonical mode. + * + * The `cbreak` option can be used to indicate that characters that + * correspond to a signal should still be generated. When disabling raw + * mode, this option is ignored. This functionality currently only works on + * Linux and Mac OS. + * + * ```ts + * Deno.stdin.setRaw(true, { cbreak: true }); + * ``` + * + * @category I/O + */ + setRaw(mode: boolean, options?: SetRawOptions): void; }; /** A handle for `stdout`. * diff --git a/cli/dts/lib.deno.unstable.d.ts b/cli/dts/lib.deno.unstable.d.ts index 6cb062396..54b328196 100644 --- a/cli/dts/lib.deno.unstable.d.ts +++ b/cli/dts/lib.deno.unstable.d.ts @@ -880,39 +880,7 @@ declare namespace Deno { symbols: S, ): DynamicLibrary<S>; - /** **UNSTABLE**: New API, yet to be vetted. - * - * @category I/O - */ - export type SetRawOptions = { - cbreak: boolean; - }; - - /** **UNSTABLE**: New API, yet to be vetted. - * - * Set TTY to be under raw mode or not. In raw mode, characters are read and - * returned as is, without being processed. All special processing of - * characters by the terminal is disabled, including echoing input characters. - * Reading from a TTY device in raw mode is faster than reading from a TTY - * device in canonical mode. - * - * The `cbreak` option can be used to indicate that characters that correspond - * to a signal should still be generated. When disabling raw mode, this option - * is ignored. This functionality currently only works on Linux and Mac OS. - * - * ```ts - * Deno.setRaw(Deno.stdin.rid, true, { cbreak: true }); - * ``` - * - * @category I/O - */ - export function setRaw( - rid: number, - mode: boolean, - options?: SetRawOptions, - ): void; - - /** **UNSTABLE**: New API, yet to be vetted. + /** **UNSTABLE**: needs investigation into high precision time. * * Synchronously changes the access (`atime`) and modification (`mtime`) times * of a file system object referenced by `path`. Given times are either in diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs index 3cafc79c6..e9285c603 100644 --- a/cli/tests/integration/run_tests.rs +++ b/cli/tests/integration/run_tests.rs @@ -3303,7 +3303,7 @@ fn set_raw_should_not_panic_on_no_tty() { let output = util::deno_cmd() .arg("eval") .arg("--unstable") - .arg("Deno.setRaw(Deno.stdin.rid, true)") + .arg("Deno.stdin.setRaw(true)") // stdin set to piped so it certainly does not refer to TTY .stdin(std::process::Stdio::piped()) // stderr is piped so we can capture output. diff --git a/cli/tests/testdata/run/unstable_worker.ts.out b/cli/tests/testdata/run/unstable_worker.ts.out index b40bdfeb8..182dc58a4 100644 --- a/cli/tests/testdata/run/unstable_worker.ts.out +++ b/cli/tests/testdata/run/unstable_worker.ts.out @@ -1,2 +1,2 @@ [Function: query] -[Function: setRaw] +[Function: consoleSize] diff --git a/cli/tests/testdata/workers/worker_unstable.ts b/cli/tests/testdata/workers/worker_unstable.ts index 5d14e228b..219f34e7b 100644 --- a/cli/tests/testdata/workers/worker_unstable.ts +++ b/cli/tests/testdata/workers/worker_unstable.ts @@ -1,5 +1,5 @@ console.log(Deno.permissions.query); -console.log(Deno.setRaw); +console.log(Deno.consoleSize); self.onmessage = () => { self.close(); }; diff --git a/cli/tests/unit/tty_color_test.ts b/cli/tests/unit/tty_color_test.ts index feb4dd470..7662d039b 100644 --- a/cli/tests/unit/tty_color_test.ts +++ b/cli/tests/unit/tty_color_test.ts @@ -1,7 +1,7 @@ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. import { assertEquals } from "./test_util.ts"; -// Note tests for Deno.setRaw is in integration tests. +// Note tests for Deno.stdin.setRaw is in integration tests. Deno.test( { permissions: { run: true, read: true } }, diff --git a/cli/tests/unit/tty_test.ts b/cli/tests/unit/tty_test.ts index e50443aab..8787db3e1 100644 --- a/cli/tests/unit/tty_test.ts +++ b/cli/tests/unit/tty_test.ts @@ -1,7 +1,7 @@ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. import { assert, assertThrows } from "./test_util.ts"; -// Note tests for Deno.setRaw is in integration tests. +// Note tests for Deno.stdin.setRaw is in integration tests. Deno.test({ permissions: { read: true } }, function consoleSizeFile() { const file = Deno.openSync("cli/tests/testdata/assets/hello.txt"); |