Detect fdesetup properly (#361)
This commit is contained in:
parent
9ab29d5e36
commit
11834a3aab
|
@ -107,17 +107,21 @@ impl Planner for Macos {
|
|||
};
|
||||
|
||||
let encrypt = if self.encrypt == None {
|
||||
Command::new("/usr/bin/fdesetup")
|
||||
let output = Command::new("/usr/bin/fdesetup")
|
||||
.arg("isactive")
|
||||
.stdout(std::process::Stdio::null())
|
||||
.stderr(std::process::Stdio::null())
|
||||
.process_group(0)
|
||||
.status()
|
||||
.output()
|
||||
.await
|
||||
.map_err(|e| PlannerError::Custom(Box::new(e)))?
|
||||
.code()
|
||||
.map(|v| if v == 0 { false } else { true })
|
||||
.unwrap_or(false)
|
||||
.map_err(|e| PlannerError::Custom(Box::new(e)))?;
|
||||
|
||||
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||
if stdout == "true" {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue