mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-07 20:15:27 +00:00
improve fatal error message
This commit is contained in:
parent
2da497c1ca
commit
70bdfc4e99
@ -182,13 +182,19 @@ pub fn run(
|
|||||||
// about whether the command succeeded without such a message
|
// about whether the command succeeded without such a message
|
||||||
info!(accessible, "Successfully compressed '{}'.", to_utf(&output_path));
|
info!(accessible, "Successfully compressed '{}'.", to_utf(&output_path));
|
||||||
} else {
|
} else {
|
||||||
|
// If Ok(false) or Err() occurred, delete incomplete file at `output_path`
|
||||||
|
//
|
||||||
|
// if deleting fails, print an extra alert message pointing
|
||||||
|
// out that we left a possibly CORRUPTED file at `output_path`
|
||||||
if let Err(_) = utils::remove_file_or_dir(&output_path) {
|
if let Err(_) = utils::remove_file_or_dir(&output_path) {
|
||||||
eprintln!("{red}FATAL ERROR:\n", red = *colors::RED);
|
eprintln!("{red}FATAL ERROR:\n", red = *colors::RED);
|
||||||
eprintln!(" Please manually delete '{}'.", to_utf(&output_path));
|
eprintln!(" Ouch failed to delete the file '{}'.", to_utf(&output_path));
|
||||||
eprintln!(
|
eprintln!(" Please delete it manually.");
|
||||||
" Compression failed and we could not delete '{}'.",
|
eprintln!(" This file is corrupted if compression didn't finished.");
|
||||||
to_utf(&output_path),
|
|
||||||
);
|
if let Err(_) = compress_result {
|
||||||
|
eprintln!(" Compression failed for reasons below.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user