diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-05-14 17:32:09 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-14 17:32:09 -0400 |
commit | e39b94f3aa09bc77280b98caebb9ae472f8f6c5a (patch) | |
tree | 8bfaec53de64cd6dcfccf2045f4231265b091fdd /runtime/ops/bootstrap.rs | |
parent | 1e2b0a22196ab2a17ceae855293fdcd5a2596161 (diff) |
fix(runtime): output to stderr with colors if a tty and stdout is piped (#23813)
This also fixes a bug where Deno would output to stderr with colours
when piped and stdout was not piped.
Diffstat (limited to 'runtime/ops/bootstrap.rs')
-rw-r--r-- | runtime/ops/bootstrap.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/runtime/ops/bootstrap.rs b/runtime/ops/bootstrap.rs index cbb87db88..eb9dbc6e8 100644 --- a/runtime/ops/bootstrap.rs +++ b/runtime/ops/bootstrap.rs @@ -16,7 +16,8 @@ deno_core::extension!( op_bootstrap_language, op_bootstrap_log_level, op_bootstrap_no_color, - op_bootstrap_is_tty, + op_bootstrap_is_stdout_tty, + op_bootstrap_is_stderr_tty, op_bootstrap_unstable_args, op_snapshot_options, ], @@ -117,7 +118,13 @@ pub fn op_bootstrap_no_color(state: &mut OpState) -> bool { } #[op2(fast)] -pub fn op_bootstrap_is_tty(state: &mut OpState) -> bool { +pub fn op_bootstrap_is_stdout_tty(state: &mut OpState) -> bool { let options = state.borrow::<BootstrapOptions>(); - options.is_tty + options.is_stdout_tty +} + +#[op2(fast)] +pub fn op_bootstrap_is_stderr_tty(state: &mut OpState) -> bool { + let options = state.borrow::<BootstrapOptions>(); + options.is_stderr_tty } |