diff --git a/lib/src/cli.rs b/lib/src/cli.rs index c5bf5a1e..76b4b88f 100644 --- a/lib/src/cli.rs +++ b/lib/src/cli.rs @@ -21,7 +21,6 @@ use ostree_ext::keyfileext::KeyFileExt; use ostree_ext::ostree; use schemars::schema_for; -use crate::deploy::wipe_ostree; use crate::deploy::RequiredHostSpec; use crate::lints; use crate::spec::Host; @@ -929,7 +928,7 @@ async fn run_from_opt(opt: Opt) -> Result<()> { StateOpts::WipeOstree => { let sysroot = ostree::Sysroot::new_default(); sysroot.load(gio::Cancellable::NONE)?; - wipe_ostree(&sysroot).await?; + crate::deploy::wipe_ostree(sysroot).await?; Ok(()) } }, diff --git a/lib/src/deploy.rs b/lib/src/deploy.rs index 67a5794e..cd1ef419 100644 --- a/lib/src/deploy.rs +++ b/lib/src/deploy.rs @@ -288,10 +288,13 @@ pub(crate) async fn prune_container_store(sysroot: &Storage) -> Result<()> { Ok(()) } -pub(crate) async fn wipe_ostree(sysroot: &Sysroot) -> Result<()> { - sysroot - .write_deployments(&[], gio::Cancellable::NONE) - .context("removing deployments")?; +pub(crate) async fn wipe_ostree(sysroot: Sysroot) -> Result<()> { + tokio::task::spawn_blocking(move || { + sysroot + .write_deployments(&[], gio::Cancellable::NONE) + .context("removing deployments") + }) + .await??; Ok(()) }