feat: Stabilize Deno.stdin.setRaw() (#16399)

This commit is contained in:
Bartek Iwańczuk 2022-10-24 17:25:06 +02:00 committed by GitHub
parent dbcbf53ab5
commit 302590015d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 14 deletions

View File

@ -27,7 +27,6 @@ const UNSTABLE_DENO_PROPS: &[&str] = &[
"Location",
"Metrics",
"OpMetrics",
"SetRawOptions",
"SignalStream",
"StartTlsOptions",
"SystemMemoryInfo",

View File

@ -1883,10 +1883,14 @@ declare namespace Deno {
*/
export const File: typeof FsFile;
/** **UNSTABLE**: new API, yet to be vetted.
*
* @category I/O */
/** @category I/O */
export interface SetRawOptions {
/**
* 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.
*/
cbreak: boolean;
}
@ -1913,19 +1917,13 @@ declare namespace Deno {
readonly rid: number;
/** A readable stream interface to `stdin`. */
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 });
* ```

View File

@ -3384,7 +3384,6 @@ async fn http2_request_url() {
fn set_raw_should_not_panic_on_no_tty() {
let output = util::deno_cmd()
.arg("eval")
.arg("--unstable")
.arg("Deno.stdin.setRaw(true)")
// stdin set to piped so it certainly does not refer to TTY
.stdin(std::process::Stdio::piped())

View File

@ -53,8 +53,6 @@ fn op_stdin_set_raw(
is_raw: bool,
cbreak: bool,
) -> Result<(), AnyError> {
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