mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 10:59:13 +00:00
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.
This commit is contained in:
parent
1e2b0a2219
commit
e39b94f3aa
5 changed files with 61 additions and 33 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue