bugfix: Let Mac users specify encryption directly (#546)

This commit is contained in:
Ana Hobden 2023-06-30 12:43:02 -07:00 committed by GitHub
parent 3586457624
commit 9c915b3f6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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![