do not error if cannot determine live usb device (#1986)

This commit is contained in:
Aiden McClelland
2022-11-28 13:56:57 -07:00
parent c3ce44e202
commit d8d13f8bf6

View File

@@ -37,7 +37,9 @@ pub fn disk() -> Result<(), Error> {
#[command(display(display_none))] #[command(display(display_none))]
pub async fn list() -> Result<Vec<DiskInfo>, Error> { pub async fn list() -> Result<Vec<DiskInfo>, Error> {
let skip = Path::new( let skip = match async {
Ok::<_, Error>(
Path::new(
&String::from_utf8( &String::from_utf8(
Command::new("grub-probe-default") Command::new("grub-probe-default")
.arg("-t") .arg("-t")
@@ -48,11 +50,22 @@ pub async fn list() -> Result<Vec<DiskInfo>, Error> {
)? )?
.trim(), .trim(),
) )
.to_owned(); .to_owned(),
)
}
.await
{
Ok(a) => Some(a),
Err(e) => {
tracing::error!("Could not determine live usb device: {}", e);
tracing::debug!("{:?}", e);
None
}
};
Ok(crate::disk::util::list(&Default::default()) Ok(crate::disk::util::list(&Default::default())
.await? .await?
.into_iter() .into_iter()
.filter(|i| &*i.logicalname != skip) .filter(|i| Some(&*i.logicalname) != skip.as_deref())
.collect()) .collect())
} }