From 9c915b3f6aa7e2b0d19027052e010d4c03824102 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Fri, 30 Jun 2023 12:43:02 -0700 Subject: [PATCH] bugfix: Let Mac users specify encryption directly (#546) --- src/planner/macos.rs | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/planner/macos.rs b/src/planner/macos.rs index 9577dc0..d2c89b0 100644 --- a/src/planner/macos.rs +++ b/src/planner/macos.rs @@ -108,25 +108,26 @@ impl Planner for Macos { }, }; - let encrypt = if self.encrypt == None { - let output = Command::new("/usr/bin/fdesetup") - .arg("isactive") - .stdout(std::process::Stdio::null()) - .stderr(std::process::Stdio::null()) - .process_group(0) - .output() - .await - .map_err(|e| PlannerError::Custom(Box::new(e)))?; + let encrypt = match self.encrypt { + Some(choice) => choice, + None => { + let output = Command::new("/usr/bin/fdesetup") + .arg("isactive") + .stdout(std::process::Stdio::null()) + .stderr(std::process::Stdio::null()) + .process_group(0) + .output() + .await + .map_err(|e| PlannerError::Custom(Box::new(e)))?; - let stdout = String::from_utf8_lossy(&output.stdout); - let stdout_trimmed = stdout.trim(); - if stdout_trimmed == "true" { - true - } else { - false - } - } else { - false + let stdout = String::from_utf8_lossy(&output.stdout); + let stdout_trimmed = stdout.trim(); + if stdout_trimmed == "true" { + true + } else { + false + } + }, }; Ok(vec![