mirror of
https://github.com/sharkdp/fd.git
synced 2024-11-19 02:10:34 +01:00
parent
39fb41f05a
commit
32a34cf8c9
2 changed files with 8 additions and 3 deletions
|
@ -101,6 +101,9 @@ fn expr_has_uppercase_char(expr: &Expr) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
/// Maximum size of the output buffer before flushing results to the console
|
||||
pub const MAX_BUFFER_LENGTH: usize = 1000;
|
||||
|
||||
/// Exit code representing a general error
|
||||
pub const EXITCODE_ERROR: i32 = 1;
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ extern crate ctrlc;
|
|||
|
||||
use exec;
|
||||
use fshelper;
|
||||
use internal::{error, FdOptions, EXITCODE_SIGINT};
|
||||
use internal::{error, FdOptions, EXITCODE_SIGINT, MAX_BUFFER_LENGTH};
|
||||
use output;
|
||||
|
||||
use std::process;
|
||||
|
@ -147,8 +147,10 @@ pub fn scan(path_vec: &[PathBuf], pattern: Arc<Regex>, config: Arc<FdOptions>) {
|
|||
ReceiverMode::Buffering => {
|
||||
buffer.push(value);
|
||||
|
||||
// Have we reached the maximum time?
|
||||
if time::Instant::now() - start > max_buffer_time {
|
||||
// Have we reached the maximum buffer size or maximum buffering time?
|
||||
if buffer.len() > MAX_BUFFER_LENGTH
|
||||
|| time::Instant::now() - start > max_buffer_time
|
||||
{
|
||||
// Flush the buffer
|
||||
for v in &buffer {
|
||||
output::print_entry(v, &rx_config, &receiver_wtq);
|
||||
|
|
Loading…
Reference in a new issue