Small fixes to eval logging

This commit is contained in:
Zhaofeng Li 2021-02-05 02:20:57 -08:00
parent 406e5a6443
commit 21c2bef3ad
2 changed files with 14 additions and 2 deletions

View file

@ -147,12 +147,17 @@ impl Host for Local {
execution.set_progress_bar(bar.clone()); execution.set_progress_bar(bar.clone());
} }
execution.run().await?; let result = execution.run().await;
let (stdout, stderr) = execution.get_logs(); let (stdout, stderr) = execution.get_logs();
self.logs += stderr.unwrap(); 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<()> { async fn activate(&mut self, profile: &Profile, goal: DeploymentGoal) -> NixResult<()> {
if goal.should_switch_profile() { if goal.should_switch_profile() {

View file

@ -2,6 +2,7 @@ use std::convert::{TryFrom, TryInto};
use std::marker::PhantomData; use std::marker::PhantomData;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::ops::Deref; use std::ops::Deref;
use std::fmt;
use serde::{Serialize, Deserialize}; use serde::{Serialize, Deserialize};
@ -84,3 +85,9 @@ impl<T: TryFrom<Vec<StorePath>, Error=NixError>> StoreDerivation<T> {
paths.try_into() paths.try_into()
} }
} }
impl<T: TryFrom<Vec<StorePath>>> fmt::Display for StoreDerivation<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{:?}", self.path)
}
}