diff --git a/Cargo.lock b/Cargo.lock index 32b9b658..5d188ae4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -893,6 +893,7 @@ dependencies = [ name = "kawari-run" version = "7.51.0" dependencies = [ + "nu-ansi-term 0.46.0", "tokio", ] @@ -1190,6 +1191,16 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "nu-ansi-term" version = "0.50.3" @@ -1229,6 +1240,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + [[package]] name = "parking_lot" version = "0.12.5" @@ -1858,7 +1875,7 @@ version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" dependencies = [ - "nu-ansi-term", + "nu-ansi-term 0.50.3", "sharded-slab", "thread_local", "tracing-core", @@ -2003,6 +2020,28 @@ dependencies = [ "libc", ] +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + [[package]] name = "windows-link" version = "0.2.1" diff --git a/Cargo.toml b/Cargo.toml index 25680938..ee988a1f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -117,3 +117,6 @@ async-trait = { version = "0.1", default-features = false } # 3D math primitives glam = { version = "0.33", features = ["std"], default-features = false } + +# For Windows ANSI support +nu-ansi-term = "0.46" diff --git a/tools/run/Cargo.toml b/tools/run/Cargo.toml index 560ce606..f9dbd921 100644 --- a/tools/run/Cargo.toml +++ b/tools/run/Cargo.toml @@ -9,3 +9,6 @@ workspace = true [dependencies] tokio = { workspace = true } + +[target.'cfg(windows)'.dependencies] +nu-ansi-term = { workspace = true } diff --git a/tools/run/src/main.rs b/tools/run/src/main.rs index d93d562c..7653ef84 100644 --- a/tools/run/src/main.rs +++ b/tools/run/src/main.rs @@ -31,6 +31,10 @@ async fn start_server(name: &str) { #[tokio::main] async fn main() { + // Enables ANSI code support on Windows. See https://github.com/tokio-rs/tracing/issues/3068 + #[cfg(windows)] + nu_ansi_term::enable_ansi_support().ok(); + // If being invoked by Cargo, build the workspace first. if let Ok(cargo) = std::env::var("CARGO") { let build_exit_status = Command::new(cargo)