mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 19:08:15 +00:00
feat: Deno.{stdin,stdout,stderr}.isTerminal()
, deprecate Deno.isatty()
(#22011)
This change: 1. Implements `Deno.stdin.isTerminal()`, `Deno.stdout.isTerminal()` and `Deno.stderr.isTerminal()`. 2. Deprecates `Deno.isatty()` for removal in Deno v2, in favour of the above instance methods. 3. Replaces use of `Deno.isatty()` with the above instance methods. Related #21995 --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
This commit is contained in:
parent
60688c563e
commit
4eedac3604
11 changed files with 92 additions and 33 deletions
|
@ -52,7 +52,7 @@ deno_core::extension!(
|
|||
deno_tty,
|
||||
ops = [
|
||||
op_stdin_set_raw,
|
||||
op_isatty,
|
||||
op_is_terminal,
|
||||
op_console_size,
|
||||
op_read_line_prompt
|
||||
],
|
||||
|
@ -210,7 +210,7 @@ fn op_stdin_set_raw(
|
|||
}
|
||||
|
||||
#[op2(fast)]
|
||||
fn op_isatty(state: &mut OpState, rid: u32) -> Result<bool, AnyError> {
|
||||
fn op_is_terminal(state: &mut OpState, rid: u32) -> Result<bool, AnyError> {
|
||||
let handle = state.resource_table.get_handle(rid)?;
|
||||
Ok(handle.is_terminal())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue