diff options
| author | Igor Soarez <igor@soarez.org> | 2026-11-05 19:21:43 +0200 |
|---|---|---|
| committer | Igor Soarez <igor@soarez.org> | 2026-11-05 19:21:43 +0200 |
| commit | 5842b093cc502b46076423e4f8efdbbc568f86aa (patch) | |
| tree | 35b5a2ab971a2b9abb3188e56e0416033b4f13ea /crates/dinggerd/src/notify.rs | |
| parent | 3b7b7ed091bae3b0609c38b2d445201cc4b7a026 (diff) | |
pi: a failed run says so: a 'failed' alert with the error, and the error in red until seen
Diffstat (limited to 'crates/dinggerd/src/notify.rs')
| -rw-r--r-- | crates/dinggerd/src/notify.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/dinggerd/src/notify.rs b/crates/dinggerd/src/notify.rs index 11b37b0..ef2c721 100644 --- a/crates/dinggerd/src/notify.rs +++ b/crates/dinggerd/src/notify.rs @@ -8,6 +8,8 @@ use tracing::{info, warn}; pub enum NotificationKind { NeedsAttention, Finished, + /// A run that ended in an error: done, but you have to act. + Failed, } impl NotificationKind { @@ -15,6 +17,7 @@ impl NotificationKind { match self { Self::NeedsAttention => "needs attention", Self::Finished => "finished", + Self::Failed => "failed", } } @@ -22,7 +25,7 @@ impl NotificationKind { /// for completions. fn sound_bytes(&self) -> &'static [u8] { match self { - Self::NeedsAttention => include_bytes!("../assets/request.mp3"), + Self::NeedsAttention | Self::Failed => include_bytes!("../assets/request.mp3"), Self::Finished => include_bytes!("../assets/done.mp3"), } } @@ -34,7 +37,7 @@ pub fn play_sound(kind: &NotificationKind) { // Test seam: play through a command instead (tests/e2e.sh). if let Ok(command) = std::env::var("DINGGER_SOUND") { let name = match kind { - NotificationKind::NeedsAttention => "request", + NotificationKind::NeedsAttention | NotificationKind::Failed => "request", NotificationKind::Finished => "done", }; let _ = Command::new("sh").args(["-c", &command, name]).stdin(Stdio::null()).spawn(); |
