mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
join: use show_error instead of eprintln (#11932)
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
// For the full copyright and license information, please view the LICENSE
|
||||
// file that was distributed with this source code.
|
||||
|
||||
// spell-checker:ignore (ToDO) autoformat FILENUM whitespaces pairable unpairable nocheck memmem
|
||||
// spell-checker:ignore (ToDO) autoformat FILENUM whitespaces nocheck memmem
|
||||
|
||||
use clap::builder::ValueParser;
|
||||
use clap::{Arg, ArgAction, Command};
|
||||
@@ -18,12 +18,11 @@ use std::os::unix::ffi::OsStrExt;
|
||||
use thiserror::Error;
|
||||
use uucore::display::Quotable;
|
||||
use uucore::error::{FromIo, UError, UResult, USimpleError, set_exit_code};
|
||||
use uucore::format_usage;
|
||||
use uucore::i18n::collator::{
|
||||
AlternateHandling, CollatorOptions, locale_cmp, should_use_locale_collation, try_init_collator,
|
||||
};
|
||||
use uucore::line_ending::LineEnding;
|
||||
use uucore::translate;
|
||||
use uucore::{format_usage, show_error, translate};
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
enum JoinError {
|
||||
@@ -650,7 +649,7 @@ impl<'a> State<'a> {
|
||||
if input.check_order == CheckOrder::Enabled {
|
||||
return Err(JoinError::UnorderedInput(err_msg));
|
||||
}
|
||||
eprintln!("{}: {err_msg}", uucore::execution_phrase());
|
||||
show_error!("{err_msg}");
|
||||
self.has_failed = true;
|
||||
}
|
||||
|
||||
@@ -1096,11 +1095,7 @@ fn exec<Sep: Separator>(
|
||||
writer.flush()?;
|
||||
|
||||
if state1.has_failed || state2.has_failed {
|
||||
eprintln!(
|
||||
"{}: {}",
|
||||
uucore::execution_phrase(),
|
||||
translate!("join-error-input-not-sorted")
|
||||
);
|
||||
show_error!("{}", translate!("join-error-input-not-sorted"));
|
||||
set_exit_code(1);
|
||||
}
|
||||
Ok(())
|
||||
|
||||
@@ -357,8 +357,7 @@ fn wrong_line_order() {
|
||||
.fails()
|
||||
.stdout_contains("7 g f 4 fg")
|
||||
.stderr_is(format!(
|
||||
"{0} {1}: fields_4.txt:5: is not sorted: 11 g 5 gh\n{0} {1}: input is not in sorted order\n",
|
||||
ts.bin_path.to_string_lossy(),
|
||||
"{0}: fields_4.txt:5: is not sorted: 11 g 5 gh\n{0}: input is not in sorted order\n",
|
||||
ts.util_name
|
||||
));
|
||||
|
||||
@@ -383,8 +382,7 @@ fn both_files_wrong_line_order() {
|
||||
.fails()
|
||||
.stdout_contains("5 e 3 ef")
|
||||
.stderr_is(format!(
|
||||
"{0} {1}: fields_5.txt:4: is not sorted: 3\n{0} {1}: fields_4.txt:5: is not sorted: 11 g 5 gh\n{0} {1}: input is not in sorted order\n",
|
||||
ts.bin_path.to_string_lossy(),
|
||||
"{0}: fields_5.txt:4: is not sorted: 3\n{0}: fields_4.txt:5: is not sorted: 11 g 5 gh\n{0}: input is not in sorted order\n",
|
||||
ts.util_name
|
||||
));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user