Skip to content

Commit

Permalink
Some pre-emptive feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
NicholasLYang committed Jun 12, 2024
1 parent 56ed732 commit 8fb5b82
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion crates/turborepo-lib/src/commands/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub async fn run(base: CommandBase, telemetry: CommandEventBuilder) -> Result<i3
.build(&handler, telemetry)
.await?;

let (sender, handle) = run.start_experimental_ui().unzip();
let (sender, handle) = run.start_experimental_ui()?.unzip();

let result = run.run(sender.clone()).await;

Expand Down
11 changes: 7 additions & 4 deletions crates/turborepo-lib/src/run/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,21 +146,24 @@ impl Run {
&& tui::terminal_big_enough()?)
}

pub fn start_experimental_ui(&self) -> Option<(AppSender, JoinHandle<Result<(), tui::Error>>)> {
#[allow(clippy::type_complexity)]
pub fn start_experimental_ui(
&self,
) -> Result<Option<(AppSender, JoinHandle<Result<(), tui::Error>>)>, Error> {
// Print prelude here as this needs to happen before the UI is started
if self.should_print_prelude {
self.print_run_prelude();
}

if !self.should_start_ui().ok()? {
return None;
if !self.should_start_ui()? {
return Ok(None);
}

let task_names = self.engine.tasks_with_command(&self.pkg_dep_graph);
let (sender, receiver) = AppSender::new();
let handle = tokio::task::spawn_blocking(move || tui::run_app(task_names, receiver));

Some((sender, handle))
Ok(Some((sender, handle)))
}

pub async fn run(&mut self, experimental_ui_sender: Option<AppSender>) -> Result<i32, Error> {
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-lib/src/run/watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl WatchClient {

let watched_packages = run.get_relevant_packages();

let (sender, handle) = run.start_experimental_ui().unzip();
let (sender, handle) = run.start_experimental_ui()?.unzip();

let connector = DaemonConnector {
can_start_server: true,
Expand Down

0 comments on commit 8fb5b82

Please sign in to comment.