mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
factor: handle the '< .' arg
This commit is contained in:
parent
22a7173305
commit
4f33a375cd
2 changed files with 17 additions and 3 deletions
|
@ -73,9 +73,18 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
let stdin = stdin();
|
||||
let lines = stdin.lock().lines();
|
||||
for line in lines {
|
||||
for number in line.unwrap().split_whitespace() {
|
||||
print_factors_str(number, &mut w, print_exponents)
|
||||
.map_err_context(|| "write error".into())?;
|
||||
match line {
|
||||
Ok(line) => {
|
||||
for number in line.split_whitespace() {
|
||||
print_factors_str(number, &mut w, print_exponents)
|
||||
.map_err_context(|| "write error".into())?;
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
set_exit_code(1);
|
||||
show_error!("error reading input: {}", e);
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1258,3 +1258,8 @@ const PRIMES50: &[u64] = &[
|
|||
1125899906841623,
|
||||
1125899906841613,
|
||||
];
|
||||
|
||||
#[test]
|
||||
fn fails_on_directory() {
|
||||
new_ucmd!().pipe_in(".").fails();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue