From a6ce2ad88fbbe7c7af9ad594a17b92199afa1b89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Wed, 1 Oct 2025 07:55:45 +0200 Subject: [PATCH] mgr: Parse all possible systemd unit states --- mgr/src/systemd.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mgr/src/systemd.rs b/mgr/src/systemd.rs index 550e8ff..6f63000 100644 --- a/mgr/src/systemd.rs +++ b/mgr/src/systemd.rs @@ -14,6 +14,7 @@ pub enum Error { pub(crate) enum UnitStatus { Active, Inactive, + Failed, } impl UnitStatus { @@ -28,8 +29,9 @@ pub(crate) mod user { pub(crate) fn unit_status(unit: &str) -> Result { let output = cmd::run_command("systemctl", &["--user", "is-active", unit])?; match output.stdout.as_str().trim() { - "active" => Ok(UnitStatus::Active), - "inactive" => Ok(UnitStatus::Inactive), + "active" | "activating" | "reloading" | "refreshing" => Ok(UnitStatus::Active), + "inactive" | "deactivating" | "maintenance" => Ok(UnitStatus::Inactive), + "failed" => Ok(UnitStatus::Failed), other => Err(Error::UnknownStatusOutput { output: other.to_owned(), }),