1
0
mirror of https://github.com/sharkdp/fd synced 2024-07-03 08:18:48 +00:00

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

Co-authored-by: sourlemon207 <jw1756@protonmail.com>
This commit is contained in:
Thayne McCombs 2021-11-15 22:21:34 -07:00 committed by David Peter
parent 7b7876e701
commit e990a13405
2 changed files with 4 additions and 1 deletions

View File

@ -93,7 +93,8 @@ fn print_entry_colorized<W: Write>(
}
if wants_to_quit.load(Ordering::Relaxed) {
stdout.flush()?;
// Ignore any errors on flush, because we're about to exit anyway
let _ = stdout.flush();
ExitCode::KilledBySigint.exit();
}

View File

@ -280,6 +280,7 @@ fn spawn_receiver(
}
}
}
num_results += 1;
if let Some(max_results) = config.max_results {
if num_results >= max_results {
@ -294,6 +295,7 @@ fn spawn_receiver(
}
}
}
// If we have finished fast enough (faster than max_buffer_time), we haven't streamed
// anything to the console, yet. In this case, sort the results and print them:
buffer.sort();