Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/uu/dd/src/progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use std::time::Duration;
#[cfg(target_os = "linux")]
use signal_hook::iterator::Handle;
use uucore::{
error::UResult,
error::{UResult, set_exit_code},
format::num_format::{FloatVariant, Formatter},
locale::setup_localization,
translate,
Expand Down Expand Up @@ -231,7 +231,9 @@ impl ProgUpdate {
/// See [`ProgUpdate::write_io_lines`] for more information.
pub(crate) fn print_io_lines(&self) {
let mut stderr = std::io::stderr();
self.write_io_lines(&mut stderr).unwrap();
if self.write_io_lines(&mut stderr).is_err() {
set_exit_code(1);
}
}

/// Re-print the number of bytes written, duration, and throughput.
Expand All @@ -240,15 +242,19 @@ impl ProgUpdate {
pub(crate) fn reprint_prog_line(&self) {
let mut stderr = std::io::stderr();
let rewrite = true;
self.write_prog_line(&mut stderr, rewrite).unwrap();
if self.write_prog_line(&mut stderr, rewrite).is_err() {
set_exit_code(1);
}
}

/// Write all summary statistics.
///
/// See [`ProgUpdate::write_transfer_stats`] for more information.
pub(crate) fn print_transfer_stats(&self, new_line: bool) {
let mut stderr = std::io::stderr();
self.write_transfer_stats(&mut stderr, new_line).unwrap();
if self.write_transfer_stats(&mut stderr, new_line).is_err() {
set_exit_code(1);
}
}

/// Write all the final statistics.
Expand Down
Loading