mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
do not error if cannot determine live usb device (#1986)
This commit is contained in:
@@ -37,22 +37,35 @@ 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 {
|
||||||
&String::from_utf8(
|
Ok::<_, Error>(
|
||||||
Command::new("grub-probe-default")
|
Path::new(
|
||||||
.arg("-t")
|
&String::from_utf8(
|
||||||
.arg("disk")
|
Command::new("grub-probe-default")
|
||||||
.arg("/cdrom")
|
.arg("-t")
|
||||||
.invoke(crate::ErrorKind::Grub)
|
.arg("disk")
|
||||||
.await?,
|
.arg("/cdrom")
|
||||||
)?
|
.invoke(crate::ErrorKind::Grub)
|
||||||
.trim(),
|
.await?,
|
||||||
)
|
)?
|
||||||
.to_owned();
|
.trim(),
|
||||||
|
)
|
||||||
|
.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())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user