From 84b3416d4ece7d31ed6ad59d142e43a4fa2a2f3d Mon Sep 17 00:00:00 2001 From: nicholaslyang Date: Thu, 18 Apr 2024 13:07:30 -0400 Subject: [PATCH] Fixes --- crates/turborepo-lib/src/run/builder.rs | 12 ++++++++++++ crates/turborepo-lib/src/run/mod.rs | 3 ++- crates/turborepo-lib/src/run/watch.rs | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/crates/turborepo-lib/src/run/builder.rs b/crates/turborepo-lib/src/run/builder.rs index a8b12e4c24953..fcc09e227aafc 100644 --- a/crates/turborepo-lib/src/run/builder.rs +++ b/crates/turborepo-lib/src/run/builder.rs @@ -59,6 +59,7 @@ pub struct RunBuilder { experimental_ui: bool, api_client: APIClient, analytics_sender: Option, + should_print_prelude: Option, } impl RunBuilder { @@ -108,6 +109,7 @@ impl RunBuilder { version, experimental_ui, analytics_sender: None, + should_print_prelude: None, }) } @@ -124,6 +126,11 @@ impl RunBuilder { self } + pub fn hide_prelude(mut self) -> Self { + self.should_print_prelude = Some(false); + self + } + // Starts analytics and returns handle. This is not included in the main `build` // function because we don't want the handle stored in the `Run` struct. pub fn start_analytics(&self) -> (Option, Option) { @@ -377,6 +384,10 @@ impl RunBuilder { self.opts.run_opts.env_mode = EnvMode::Strict; } + let should_print_prelude = self + .should_print_prelude + .unwrap_or(self.opts.run_opts.dry_run.is_none() && self.opts.run_opts.graph.is_none()); + Ok(Run { version: self.version, ui: self.ui, @@ -397,6 +408,7 @@ impl RunBuilder { engine: Arc::new(engine), run_cache, signal_handler: signal_handler.clone(), + should_print_prelude, }) } diff --git a/crates/turborepo-lib/src/run/mod.rs b/crates/turborepo-lib/src/run/mod.rs index 2f4f820b3af21..f85706629e56d 100644 --- a/crates/turborepo-lib/src/run/mod.rs +++ b/crates/turborepo-lib/src/run/mod.rs @@ -61,6 +61,7 @@ pub struct Run { signal_handler: SignalHandler, engine: Arc, task_access: TaskAccess, + should_print_prelude: bool, } impl Run { @@ -115,7 +116,7 @@ impl Run { } pub async fn run(&self) -> Result { - if self.opts.run_opts.dry_run.is_none() && self.opts.run_opts.graph.is_none() { + if self.should_print_prelude { self.print_run_prelude(); } if let Some(subscriber) = self.signal_handler.subscribe() { diff --git a/crates/turborepo-lib/src/run/watch.rs b/crates/turborepo-lib/src/run/watch.rs index 3f35d21c1e12e..a6207578ec99a 100644 --- a/crates/turborepo-lib/src/run/watch.rs +++ b/crates/turborepo-lib/src/run/watch.rs @@ -180,7 +180,7 @@ impl WatchClient { current_runs.insert( package_name, tokio::spawn(async move { - let mut run = RunBuilder::new(new_base)? + let run = RunBuilder::new(new_base)? .build(&handler, telemetry) .await?; run.run().await