diff --git a/deep_research/src/core.rs b/deep_research/src/core.rs index ad8ed03..fcfbc9d 100644 --- a/deep_research/src/core.rs +++ b/deep_research/src/core.rs @@ -178,7 +178,6 @@ async fn write_report( drop(spinner); let mut report = String::new(); - let stdout = std::io::stdout(); while let Some(chunk) = response_stream.next().await { match chunk? { @@ -187,9 +186,11 @@ async fn write_report( .. })) => { report.push_str(&text); - let mut handle = stdout.lock(); - write!(handle, "{text}")?; - handle.flush()?; + // Terminal stdout is line-buffered, so a flush is needed here — + // otherwise a chunk without a trailing newline sits in the + // buffer instead of appearing as it streams in. + print!("{text}"); + std::io::stdout().flush()?; } _ => continue, }