Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable vt processing on windows #7158

Merged
merged 5 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/turborepo-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ clap = { workspace = true, features = ["derive", "env"] }
clap_complete = { workspace = true }
command-group = { version = "2.1.0", features = ["with-tokio"] }
console = { workspace = true }
crossterm = "0.26"
ctrlc = { version = "3.4.0", features = ["termination"] }
dialoguer = { workspace = true, features = ["fuzzy-select"] }
directories = "4.0.1"
Expand Down
21 changes: 20 additions & 1 deletion crates/turborepo-lib/src/shim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,30 @@ impl ShimArgs {
if self.no_color {
UI::new(true)
} else if self.color {
// Do our best to enable ansi colors, but even if the terminal doesn't support
// still emit ansi escape sequences.
Self::supports_ansi();
UI::new(false)
} else {
} else if Self::supports_ansi() {
// If the terminal supports ansi colors, then we can infer if we should emit
// colors
UI::infer()
} else {
UI::new(true)
}
}

#[cfg(windows)]
fn supports_ansi() -> bool {
// This call has the side effect of setting ENABLE_VIRTUAL_TERMINAL_PROCESSING
// to true. https://learn.microsoft.com/en-us/windows/console/setconsolemode
crossterm::ansi_support::supports_ansi()
}

#[cfg(not(windows))]
fn supports_ansi() -> bool {
true
}
}

#[derive(Debug, Clone, Deserialize)]
Expand Down
Loading