diff --git a/src/nix/host/key_uploader.rs b/src/nix/host/key_uploader.rs index dc97be5..28539eb 100644 --- a/src/nix/host/key_uploader.rs +++ b/src/nix/host/key_uploader.rs @@ -46,7 +46,8 @@ pub async fn feed_uploader(mut uploader: Child, key: &Key, job: Option PathBuf { } } -pub async fn capture_stream(mut stream: BufReader, job: Option, stderr: bool) -> String { +pub async fn capture_stream(mut stream: BufReader, job: Option, stderr: bool) -> NixResult + where R: AsyncRead + Unpin +{ let mut log = String::new(); loop { let mut line = String::new(); - let len = stream.read_line(&mut line).await.unwrap(); + let len = stream.read_line(&mut line).await?; if len == 0 { break; @@ -188,9 +190,9 @@ pub async fn capture_stream(mut stream: BufReader, job: if let Some(job) = &job { if stderr { - job.stderr(trimmed.to_string()).unwrap(); + job.stderr(trimmed.to_string())?; } else { - job.stdout(trimmed.to_string()).unwrap(); + job.stdout(trimmed.to_string())?; } } @@ -198,7 +200,7 @@ pub async fn capture_stream(mut stream: BufReader, job: log += "\n"; } - log + Ok(log) } pub fn get_label_width(targets: &TargetNodeMap) -> Option {