mirror of
https://codeberg.org/icewind/palantir.git
synced 2026-06-03 18:24:08 +02:00
zfs fallback
This commit is contained in:
parent
e858c30645
commit
b62d3bd56b
1 changed files with 6 additions and 3 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
use color_eyre::{Report, Result};
|
use color_eyre::Result;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use tokio::task::spawn_blocking;
|
use tokio::task::spawn_blocking;
|
||||||
|
|
||||||
|
|
@ -17,7 +17,10 @@ impl ZFS {
|
||||||
spawn_blocking(move || {
|
spawn_blocking(move || {
|
||||||
let mut z = Command::new("zpool");
|
let mut z = Command::new("zpool");
|
||||||
z.args(&["list", "-p", "-H", "-o", "name,size,free"]);
|
z.args(&["list", "-p", "-H", "-o", "name,size,free"]);
|
||||||
let out = z.output()?;
|
let out = match z.output() {
|
||||||
|
Ok(out) => out,
|
||||||
|
Err(_) => return Ok(Vec::new()),
|
||||||
|
};
|
||||||
if out.status.success() {
|
if out.status.success() {
|
||||||
let output = String::from_utf8(out.stdout)?;
|
let output = String::from_utf8(out.stdout)?;
|
||||||
Ok(output
|
Ok(output
|
||||||
|
|
@ -31,7 +34,7 @@ impl ZFS {
|
||||||
})
|
})
|
||||||
.collect())
|
.collect())
|
||||||
} else {
|
} else {
|
||||||
Err(Report::msg(String::from_utf8(out.stderr)?))
|
Ok(Vec::new())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.await?
|
.await?
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue