1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 19:47:45 +00:00

Merge pull request #3078 from ndd7xv/dd-progress-fix

dd: make status=progress rewrite once/sec
This commit is contained in:
Sylvestre Ledru 2022-02-12 11:34:21 +01:00 committed by GitHub
commit 52282740dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -866,10 +866,14 @@ fn gen_prog_updater(rx: mpsc::Receiver<ProgUpdate>, print_level: Option<StatusLe
}
});
let mut progress_as_secs = 0;
while let Ok(update) = rx.recv() {
// (Re)print status line if progress is requested.
if Some(StatusLevel::Progress) == print_level {
if Some(StatusLevel::Progress) == print_level
&& update.duration.as_secs() >= progress_as_secs
{
reprint_prog_line(&update);
progress_as_secs = update.duration.as_secs() + 1;
}
// Handle signals
#[cfg(target_os = "linux")]