diff --git a/src/bin/repo.rs b/src/bin/repo.rs index 1c94c4ee3..713b79ec2 100644 --- a/src/bin/repo.rs +++ b/src/bin/repo.rs @@ -361,8 +361,8 @@ fn repo_inner( if let Err(err_ctx) = &result { write_to_pty(&logger, &format!("\n{:?}", err_ctx)); } - // successful fetch is not that useful to log - if *command == CliCommand::Cook || result.is_err() { + // successful cached build is not that useful to log + if !matches!(result, Ok(true)) { flush_pty(&mut logger); let log_path = log_path.join(format!("{}/{}.log", recipe.target, recipe.name.name())); @@ -1096,9 +1096,10 @@ impl TuiApp { let _ = std::io::stdout().write_all(&chunk); } let log_list = self.logs.entry(name.clone()).or_default(); + // TODO: multibyte-aware line split? while let Some(newline_pos) = buffer.iter().position(|&b| b == b'\n') { - let line_bytes = buffer.drain(..=newline_pos).collect::>(); - let line_str = String::from_utf8_lossy(&line_bytes).into_owned(); + let line_bytes = buffer.drain(..=newline_pos); + let line_str = String::from_utf8_lossy(&line_bytes.as_slice()); let line_str_pos = line_str.trim_end(); let line_str = line_str_pos.rsplit('\r').next().unwrap_or(&line_str_pos); log_list.push(line_str.to_owned()); @@ -1194,7 +1195,10 @@ fn run_tui_cook(config: CliConfig, recipes: Vec) -> Result) -> Result