Invoke systemctl via PATH instead of /usr/bin
Audit / cargo-audit (push) Successful in 3s
Update PKGBUILD version / update-pkgver (push) Successful in 3s

The absolute path assumes an FHS layout and fails on distributions that
place systemctl elsewhere, such as NixOS.
This commit is contained in:
2026-08-07 13:24:54 +02:00
parent e9f45a862e
commit db8e5807e7
3 changed files with 4 additions and 4 deletions
Generated
+1 -1
View File
@@ -575,7 +575,7 @@ dependencies = [
[[package]]
name = "moonlock"
version = "0.6.20"
version = "0.6.21"
dependencies = [
"gdk-pixbuf",
"gdk4",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "moonlock"
version = "0.6.20"
version = "0.6.21"
edition = "2024"
description = "A secure Wayland lockscreen with GTK4, PAM and fingerprint support"
license = "MIT"
+2 -2
View File
@@ -34,8 +34,8 @@ fn run_command(action: &'static str, program: &str, args: &[&str]) -> Result<(),
Ok(())
}
pub fn reboot() -> Result<(), PowerError> { run_command("reboot", "/usr/bin/systemctl", &["--no-ask-password", "reboot"]) }
pub fn shutdown() -> Result<(), PowerError> { run_command("shutdown", "/usr/bin/systemctl", &["--no-ask-password", "poweroff"]) }
pub fn reboot() -> Result<(), PowerError> { run_command("reboot", "systemctl", &["--no-ask-password", "reboot"]) }
pub fn shutdown() -> Result<(), PowerError> { run_command("shutdown", "systemctl", &["--no-ask-password", "poweroff"]) }
#[cfg(test)]
mod tests {