Skip to content

Commit 1fd6c69

Browse files
authored
Merge pull request #779 from omertuc/spawn_blocking
cli: wipe_ostree in spawn_blocking
2 parents c53ca55 + 0eb8d3b commit 1fd6c69

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

lib/src/cli.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use ostree_ext::keyfileext::KeyFileExt;
2121
use ostree_ext::ostree;
2222
use schemars::schema_for;
2323

24-
use crate::deploy::wipe_ostree;
2524
use crate::deploy::RequiredHostSpec;
2625
use crate::lints;
2726
use crate::spec::Host;
@@ -929,7 +928,7 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
929928
StateOpts::WipeOstree => {
930929
let sysroot = ostree::Sysroot::new_default();
931930
sysroot.load(gio::Cancellable::NONE)?;
932-
wipe_ostree(&sysroot).await?;
931+
crate::deploy::wipe_ostree(sysroot).await?;
933932
Ok(())
934933
}
935934
},

lib/src/deploy.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,13 @@ pub(crate) async fn prune_container_store(sysroot: &Storage) -> Result<()> {
288288
Ok(())
289289
}
290290

291-
pub(crate) async fn wipe_ostree(sysroot: &Sysroot) -> Result<()> {
292-
sysroot
293-
.write_deployments(&[], gio::Cancellable::NONE)
294-
.context("removing deployments")?;
291+
pub(crate) async fn wipe_ostree(sysroot: Sysroot) -> Result<()> {
292+
tokio::task::spawn_blocking(move || {
293+
sysroot
294+
.write_deployments(&[], gio::Cancellable::NONE)
295+
.context("removing deployments")
296+
})
297+
.await??;
295298

296299
Ok(())
297300
}

0 commit comments

Comments
 (0)