mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 03:57:44 +00:00
Fix type-error when calling parse_size
from stdbuf
This commit is contained in:
parent
468ff8f0b9
commit
e9adf979d9
1 changed files with 9 additions and 2 deletions
|
@ -11,7 +11,7 @@
|
||||||
extern crate uucore;
|
extern crate uucore;
|
||||||
|
|
||||||
use clap::{crate_version, App, AppSettings, Arg, ArgMatches};
|
use clap::{crate_version, App, AppSettings, Arg, ArgMatches};
|
||||||
use std::convert::TryFrom;
|
use std::convert::{TryFrom, TryInto};
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
use std::os::unix::process::ExitStatusExt;
|
use std::os::unix::process::ExitStatusExt;
|
||||||
|
@ -117,7 +117,14 @@ fn check_option(matches: &ArgMatches, name: &str) -> Result<BufferType, ProgramO
|
||||||
}
|
}
|
||||||
x => parse_size(x).map_or_else(
|
x => parse_size(x).map_or_else(
|
||||||
|e| crash!(125, "invalid mode {}", e),
|
|e| crash!(125, "invalid mode {}", e),
|
||||||
|m| Ok(BufferType::Size(m)),
|
|m| {
|
||||||
|
Ok(BufferType::Size(m.try_into().map_err(|_| {
|
||||||
|
ProgramOptionsError(format!(
|
||||||
|
"invalid mode {}: Value too large for defined data type",
|
||||||
|
x
|
||||||
|
))
|
||||||
|
})?))
|
||||||
|
},
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
None => Ok(BufferType::Default),
|
None => Ok(BufferType::Default),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue