Skip to content
Myr

squash! Add buffering to stdout when it's not a terminal

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Thayne McCombs · committed by David Peter · parent 7b7876e · Browse files · 2 files+4 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: sourlemon207 <jw1756@protonmail.com>

Diff stats

2 files+4 added−1 removed

  • other:+4 added−1 removed

2 files+4 added−1 removed

modified:src/output.rs+2 added-1 removed
91 unmodified lines
92 writeln!(stdout)?;93 }9495 if wants_to_quit.load(Ordering::Relaxed) {96 stdout.flush()?;96 // Ignore any errors on flush, because we're about to exit anyway97 let _ = stdout.flush();98 ExitCode::KilledBySigint.exit();99 }100101 Ok(())
44 unmodified lines
modified:src/walk.rs+2 added
278 unmodified lines
279 return ExitCode::GeneralError;280 }281 }282 }283284 num_results += 1;285 if let Some(max_results) = config.max_results {286 if num_results >= max_results {287 break;
6 unmodified lines
294 }295 }296 }297 }298299 // If we have finished fast enough (faster than max_buffer_time), we haven't streamed300 // anything to the console, yet. In this case, sort the results and print them:301 buffer.sort();302 for value in buffer {
233 unmodified lines