From 21c2bef3adf460a974d324699dfa17269be21b09 Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Fri, 5 Feb 2021 02:20:57 -0800 Subject: [PATCH] Small fixes to eval logging --- src/nix/host.rs | 9 +++++++-- src/nix/store.rs | 7 +++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/nix/host.rs b/src/nix/host.rs index 484a7a4..9acd945 100644 --- a/src/nix/host.rs +++ b/src/nix/host.rs @@ -147,12 +147,17 @@ impl Host for Local { execution.set_progress_bar(bar.clone()); } - execution.run().await?; + let result = execution.run().await; let (stdout, stderr) = execution.get_logs(); self.logs += stderr.unwrap(); - stdout.unwrap().lines().map(|p| p.to_string().try_into()).collect() + match result { + Ok(()) => { + stdout.unwrap().lines().map(|p| p.to_string().try_into()).collect() + } + Err(e) => Err(e), + } } async fn activate(&mut self, profile: &Profile, goal: DeploymentGoal) -> NixResult<()> { if goal.should_switch_profile() { diff --git a/src/nix/store.rs b/src/nix/store.rs index 853cf39..93fb511 100644 --- a/src/nix/store.rs +++ b/src/nix/store.rs @@ -2,6 +2,7 @@ use std::convert::{TryFrom, TryInto}; use std::marker::PhantomData; use std::path::{Path, PathBuf}; use std::ops::Deref; +use std::fmt; use serde::{Serialize, Deserialize}; @@ -84,3 +85,9 @@ impl, Error=NixError>> StoreDerivation { paths.try_into() } } + +impl>> fmt::Display for StoreDerivation { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{:?}", self.path) + } +}