Skip to content

Commit

Permalink
Merge pull request #94 from andreivdev/master
Browse files Browse the repository at this point in the history
fail gracefully when there is no lsblk
  • Loading branch information
JohnnyFFM authored May 24, 2021
2 parents f3e7944 + 4568e43 commit e77fe01
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,10 @@ cfg_if! {
.arg("-o")
.arg("PHY-SeC")
.output()
.expect("failed to execute 'lsblk -o PHY-SeC'");
.map(|output| output.stdout)
.unwrap_or_default();

let sector_size = String::from_utf8(output.stdout).expect("not utf8");
let sector_size = String::from_utf8(output).expect("not utf8");
let sector_size = sector_size.split('\n').collect::<Vec<&str>>().get(1).unwrap_or_else(|| {
warn!("failed to determine sector size, defaulting to 4096.");
&"4096"
Expand Down

0 comments on commit e77fe01

Please sign in to comment.