fix: use systemctl instead of loginctl for reboot/poweroff
loginctl has no reboot/poweroff subcommands — these are systemctl commands. The error was silently swallowed because stderr wasn't captured and logs went to a non-existent directory.
This commit is contained in:
parent
17f8930ff7
commit
78bcf90492
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -693,7 +693,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "moonlock"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
dependencies = [
|
||||
"env_logger",
|
||||
"gdk-pixbuf",
|
||||
|
||||
@ -37,8 +37,8 @@ fn run_command(action: &'static str, program: &str, args: &[&str]) -> Result<(),
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn reboot() -> Result<(), PowerError> { run_command("reboot", "/usr/bin/loginctl", &["reboot"]) }
|
||||
pub fn shutdown() -> Result<(), PowerError> { run_command("shutdown", "/usr/bin/loginctl", &["poweroff"]) }
|
||||
pub fn reboot() -> Result<(), PowerError> { run_command("reboot", "/usr/bin/systemctl", &["reboot"]) }
|
||||
pub fn shutdown() -> Result<(), PowerError> { run_command("shutdown", "/usr/bin/systemctl", &["poweroff"]) }
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user