Merge pull request 'minor fixes to main()' (#12) from emma/breed:main into main
Reviewed-on: #12
This commit is contained in:
commit
a7e121ba18
|
@ -472,12 +472,12 @@ fn main() -> Result<()> {
|
|||
if unsafe { libc::isatty(stdin) } == 0 {
|
||||
unsafe { File::from_raw_fd(stdin) }
|
||||
} else {
|
||||
File::open("/dev/null").unwrap()
|
||||
File::open("/dev/null")?
|
||||
}
|
||||
}
|
||||
Some(path) => {
|
||||
let input_file = Path::new(path);
|
||||
file_name = Some(OsString::from(input_file.clone().display().to_string()));
|
||||
file_name = Some(OsString::from(&path));
|
||||
|
||||
File::open(input_file).unwrap_or_else(|_| {
|
||||
let mut err = String::new();
|
||||
|
@ -491,8 +491,7 @@ fn main() -> Result<()> {
|
|||
})
|
||||
}
|
||||
}
|
||||
.read_to_end(&mut buf)
|
||||
.unwrap();
|
||||
.read_to_end(&mut buf)?;
|
||||
|
||||
let text = String::from_utf8(buf).unwrap_or_else(|_| {
|
||||
eprintln!(
|
||||
|
|
Loading…
Reference in New Issue