From b6f5d01597e4f5b8b80dac782ca10c4196e85069 Mon Sep 17 00:00:00 2001 From: Wildan M Date: Mon, 24 Nov 2025 07:31:51 -0800 Subject: [PATCH] Fix non tui with logs flow --- src/bin/repo.rs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/bin/repo.rs b/src/bin/repo.rs index b3f09a22..8cfed9c9 100644 --- a/src/bin/repo.rs +++ b/src/bin/repo.rs @@ -292,13 +292,20 @@ fn repo_inner( let (status_tx, status_rx) = mpsc::channel::(); let (mut stdout_writer, mut stderr_writer) = setup_logger(&status_tx, &recipe.name); let mut app = TuiApp::new(vec![recipe.clone()]); - app.dump_logs_anyway = true; + app.dump_logs_anyway = config.cook.verbose || !config.cook.nonstop; + let dump_fail_logs = !app.dump_logs_anyway; let th = thread::spawn(move || { while let Ok(update) = status_rx.recv() { - if update == StatusUpdate::CookThreadFinished { - break; + match &update { + StatusUpdate::CookThreadFinished => break, + StatusUpdate::FailCook(r, _) => { + let (logs, line) = app.get_recipe_log(&r.name); + if let Some(logs) = logs { + println!("{}", join_logs(logs, line)); + } + } + _ => app.update_status(update), } - app.update_status(update); } }); let mut logger = Some((&mut stdout_writer, &mut stderr_writer)); @@ -313,11 +320,17 @@ fn repo_inner( status_tx .send(StatusUpdate::FlushLog(recipe.name.clone(), log_path)) .unwrap_or_default(); + if dump_fail_logs && result.is_err() { + status_tx + .send(StatusUpdate::FailCook(recipe.clone(), "".into())) + .unwrap_or_default(); + } } status_tx .send(StatusUpdate::CookThreadFinished) .unwrap_or_default(); let _ = th.join(); + result?; } CliCommand::Unfetch => handle_clean(recipe, config, true, true)?, CliCommand::Clean => handle_clean(recipe, config, false, true)?,