Skip to content

Commit 79cf124

Browse files
oech3oech3
authored andcommitted
coreutils: Print utility not found to stderr
1 parent 7c62885 commit 79cf124

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/common/validation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub fn get_all_utilities<T: Args>(
2525

2626
/// Prints a "utility not found" error and exits
2727
pub fn not_found(util: &OsStr) -> ! {
28-
println!("{}: function/utility not found", util.maybe_quote());
28+
eprintln!("{}: function/utility not found", util.maybe_quote());
2929
process::exit(1);
3030
}
3131

tests/test_util_name.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ fn util_invalid_name_help() {
126126
.unwrap();
127127
let output = child.wait_with_output().unwrap();
128128
assert_eq!(output.status.code(), Some(0));
129-
assert_eq!(output.stderr, b"");
129+
assert_eq!(output.stdout, b"");
130130
let output_str = String::from_utf8(output.stdout).unwrap();
131131
assert!(output_str.contains("(multi-call binary)"), "{output_str:?}");
132132
assert!(
@@ -197,7 +197,7 @@ fn util_invalid_name_invalid_command() {
197197
assert_eq!(output.status.code(), Some(1));
198198
assert_eq!(output.stderr, b"");
199199
assert_eq!(
200-
output.stdout,
200+
output.stderr,
201201
b"definitely_invalid: function/utility not found\n"
202202
);
203203
}

0 commit comments

Comments
 (0)