Skip to content

Commit

Permalink
Adding back is_ci
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholaslyang authored and nicholaslyang committed Aug 8, 2023
1 parent ef5aca7 commit 894f332
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 10 deletions.
35 changes: 27 additions & 8 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion crates/turborepo-lib/src/run/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use tracing::{debug, info};
use turborepo_cache::{http::APIAuth, AsyncCache};
use turborepo_env::EnvironmentVariableMap;
use turborepo_scm::SCM;
use turborepo_ui::UI;

use crate::{
commands::CommandBase, config::TurboJson, daemon::DaemonConnector, manager::Manager,
Expand Down Expand Up @@ -61,7 +62,7 @@ impl Run {
}

// There's some warning handling code in Go that I'm ignoring
if self.base.ui.is_ci() && !opts.run_opts.no_daemon {
if UI::is_ci() && !opts.run_opts.no_daemon {
info!("skipping turbod since we appear to be in a non-interactive context");
} else if !opts.run_opts.no_daemon {
let connector = DaemonConnector {
Expand Down
1 change: 1 addition & 0 deletions crates/turborepo-ui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ lazy_static = { workspace = true }
thiserror = { workspace = true }
tracing = { workspace = true }
turbopath = { workspace = true }
turborepo-ci = { workspace = true }
6 changes: 5 additions & 1 deletion crates/turborepo-ui/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod log_replayer;

use std::{borrow::Cow, env, f64::consts::PI, time::Duration};
use std::{borrow::Cow, env, f64::consts::PI, io::IsTerminal, time::Duration};

use console::{Style, StyledObject};
use indicatif::{ProgressBar, ProgressStyle};
Expand Down Expand Up @@ -50,6 +50,10 @@ impl UI {
Self { should_strip_ansi }
}

pub fn is_ci() -> bool {
turborepo_ci::is_ci() && std::io::stdout().is_terminal()
}

/// Infer the color choice from environment variables and checking if stdout
/// is a tty
pub fn infer() -> Self {
Expand Down

0 comments on commit 894f332

Please sign in to comment.