Fix enabling ANSI support when stdout is redirected. (#497)
This commit is contained in:
parent
efb06b8baa
commit
4b1c857914
@ -1,4 +1,4 @@
|
|||||||
use crossterm_winapi::ConsoleMode;
|
use crossterm_winapi::{ConsoleMode, Handle};
|
||||||
use winapi::um::wincon::ENABLE_VIRTUAL_TERMINAL_PROCESSING;
|
use winapi::um::wincon::ENABLE_VIRTUAL_TERMINAL_PROCESSING;
|
||||||
|
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
@ -17,7 +17,7 @@ use crate::Result;
|
|||||||
pub(crate) fn set_virtual_terminal_processing(yes: bool) -> Result<()> {
|
pub(crate) fn set_virtual_terminal_processing(yes: bool) -> Result<()> {
|
||||||
let mask = ENABLE_VIRTUAL_TERMINAL_PROCESSING;
|
let mask = ENABLE_VIRTUAL_TERMINAL_PROCESSING;
|
||||||
|
|
||||||
let console_mode = ConsoleMode::new()?;
|
let console_mode = ConsoleMode::from(Handle::current_out_handle()?);
|
||||||
let old_mode = console_mode.mode()?;
|
let old_mode = console_mode.mode()?;
|
||||||
|
|
||||||
let new_mode = if yes {
|
let new_mode = if yes {
|
||||||
|
Loading…
Reference in New Issue
Block a user