mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37: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,11 +73,20 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
let stdin = stdin();
|
let stdin = stdin();
|
||||||
let lines = stdin.lock().lines();
|
let lines = stdin.lock().lines();
|
||||||
for line in lines {
|
for line in lines {
|
||||||
for number in line.unwrap().split_whitespace() {
|
match line {
|
||||||
|
Ok(line) => {
|
||||||
|
for number in line.split_whitespace() {
|
||||||
print_factors_str(number, &mut w, print_exponents)
|
print_factors_str(number, &mut w, print_exponents)
|
||||||
.map_err_context(|| "write error".into())?;
|
.map_err_context(|| "write error".into())?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Err(e) => {
|
||||||
|
set_exit_code(1);
|
||||||
|
show_error!("error reading input: {}", e);
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Err(e) = w.flush() {
|
if let Err(e) = w.flush() {
|
||||||
|
|
|
@ -1258,3 +1258,8 @@ const PRIMES50: &[u64] = &[
|
||||||
1125899906841623,
|
1125899906841623,
|
||||||
1125899906841613,
|
1125899906841613,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn fails_on_directory() {
|
||||||
|
new_ucmd!().pipe_in(".").fails();
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue