Enable ANSI support for Windows 10 Console
On Windows 10, console applications must activate ANSI support in order for colors to be supported.
This commit is contained in:
parent
b7a126742f
commit
9eac537a01
10
src/run.rs
10
src/run.rs
@ -2,10 +2,13 @@ use common::*;
|
||||
|
||||
use std::{convert, ffi, cmp};
|
||||
use clap::{App, Arg, ArgGroup, AppSettings};
|
||||
use misc::maybe_s;
|
||||
use configuration::DEFAULT_SHELL;
|
||||
use misc::maybe_s;
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
#[cfg(windows)]
|
||||
use ansi_term::enable_ansi_support;
|
||||
|
||||
macro_rules! die {
|
||||
($($arg:tt)*) => {{
|
||||
extern crate std;
|
||||
@ -132,6 +135,11 @@ pub fn run() {
|
||||
other => die!("Invalid argument `{}` to --color. This is a bug in just.", other),
|
||||
};
|
||||
|
||||
if color.active() {
|
||||
#[cfg(windows)]
|
||||
enable_ansi_support().ok();
|
||||
}
|
||||
|
||||
let set_count = matches.occurrences_of("SET");
|
||||
let mut overrides = Map::new();
|
||||
if set_count > 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user