From f0b1e6910056b9012c0f69ad945b2291c6552319 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Thu, 29 Aug 2024 16:46:20 -0400 Subject: [PATCH] A couple more contexts in the post-build-hook --- magic-nix-cache/src/pbh.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/magic-nix-cache/src/pbh.rs b/magic-nix-cache/src/pbh.rs index b75806b..cda2ad5 100644 --- a/magic-nix-cache/src/pbh.rs +++ b/magic-nix-cache/src/pbh.rs @@ -164,9 +164,20 @@ pub async fn setup_legacy_post_build_hook( &path.display().to_string(), ]) .output() - .await?; + .await + .with_context(|| { + format!( + "Running nix to add the post-build-hook to the store from {}", + path.display() + ) + })?; if res.status.success() { - tokio::fs::remove_file(path).await?; + tokio::fs::remove_file(&path).await.with_context(|| { + format!( + "Cleaning up the temporary post-build-hook at {}", + path.display() + ) + })?; PathBuf::from(String::from_utf8_lossy(&res.stdout).trim()) } else { path