From c1db92cb2285fdd6b29a6678159cf67ee4e2391f Mon Sep 17 00:00:00 2001 From: Wildan M Date: Mon, 3 Nov 2025 21:35:47 +0700 Subject: [PATCH] Add error context into logs --- src/bin/repo.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bin/repo.rs b/src/bin/repo.rs index 50fd28a0e..59692cc93 100644 --- a/src/bin/repo.rs +++ b/src/bin/repo.rs @@ -7,6 +7,7 @@ use cookbook::cook::fs::{create_target_dir, run_command}; use cookbook::cook::package::package; use cookbook::cook::pty::{PtyOut, UnixSlavePty, setup_pty}; use cookbook::cook::tree::{display_tree_entry, format_size}; +use cookbook::log_to_pty; use cookbook::recipe::{BuildKind, CookRecipe}; use pkg::PackageName; use pkg::package::PackageError; @@ -859,6 +860,9 @@ fn run_tui_cook( &logger, ); if let Some(log_path) = cooker_config.logs_dir.as_ref() { + if let Err(err_ctx) = &handler { + log_to_pty!(&logger, "{:?}", err_ctx) + } let log_path = log_path.join(format!("{}.log", name.as_str())); cooker_status_tx .send(StatusUpdate::FlushLog(name.clone(), log_path)) @@ -949,6 +953,9 @@ fn run_tui_cook( // successful fetch log usually not that helpful && handler.is_err() { + if let Err(err_ctx) = &handler { + log_to_pty!(&logger, "{:?}", err_ctx) + } let log_path = log_path.join(format!("{}.log", name.as_str())); fetcher_status_tx .send(StatusUpdate::FlushLog(name.clone(), log_path))