From ec9855e3c22fd37c9a18d3eeb32c4a158bb71425 Mon Sep 17 00:00:00 2001 From: Cara Salter Date: Fri, 10 Jun 2022 10:58:54 -0400 Subject: star: Make planet() sync --- src/star.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/star.rs b/src/star.rs index 65b9fa8..7d3c21d 100644 --- a/src/star.rs +++ b/src/star.rs @@ -11,7 +11,7 @@ use std::process::{ExitStatus}; use std::os::unix::process::ExitStatusExt; use rand::Rng; -use tokio::{process::Command}; +use std::{process::Command}; #[derive(Serialize, Deserialize, Debug)] pub enum Address { @@ -124,7 +124,7 @@ impl Star { /// If the installation image doesn't exist in the default libvirtd pool, this will fail with /// [`Error::MissingImage`][crate::errors::Error::MissingImage]. /// - pub async fn planet(&mut self, name: String, max_mem: Memory, max_cpus: CpuCount, disk_size_mb: u64, ship: Ship) -> Result { + pub fn planet(&mut self, name: String, max_mem: Memory, max_cpus: CpuCount, disk_size_mb: u64, ship: Ship) -> Result { // Check for image on host machine if self.remote { @@ -135,8 +135,7 @@ impl Star { "stat", &format!("/var/lib/libvirt/images/{}", ship.make_pretty_name().clone()) ]) - .output() - .await?; + .output()?; if output.status != ExitStatus::from_raw(0) { return Err(Error::MissingImage(ship.name.clone())); @@ -154,8 +153,7 @@ impl Star { &format!("/var/lib/libvirt/images/{}.qcow2", name.clone()), &format!("{}M", disk_size_mb) ]) - .output() - .await?; + .output()?; if output.status != ExitStatus::from_raw(0) { return Err(Error::Allocation(String::from_utf8(output.stdout).unwrap())); @@ -166,8 +164,7 @@ impl Star { .args([ &format!("/var/lib/libvirt/images/{}", ship.make_pretty_name().clone()), ]) - .output() - .await?; + .output()?; if output.status != ExitStatus::from_raw(0) { return Err(Error::MissingImage(ship.name.clone())); @@ -181,8 +178,7 @@ impl Star { &format!("/var/lib/libvirt/images/{}.qcow2", name.clone()), &format!("{}M", disk_size_mb) ]) - .output() - .await?; + .output()?; if output.status != ExitStatus::from_raw(0) { return Err(Error::Allocation(String::from_utf8(output.stdout).unwrap())); -- cgit v1.2.3