guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[shepherd] 04/08: timer: ‘trigger’ action prints a hint when passed #f.


From: Ludovic Courtès
Subject: [shepherd] 04/08: timer: ‘trigger’ action prints a hint when passed #f.
Date: Fri, 9 Aug 2024 17:12:32 -0400 (EDT)

civodul pushed a commit to branch devel
in repository shepherd.

commit ca4976a846860e594c20c49b711431c6a48d8f86
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Fri Aug 9 16:37:19 2024 +0200

    timer: ‘trigger’ action prints a hint when passed #f.
    
    * modules/shepherd/service/timer.scm (trigger-timer): Print a hint when
    TIMER is #f.
---
 modules/shepherd/service/timer.scm | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/modules/shepherd/service/timer.scm 
b/modules/shepherd/service/timer.scm
index 4473676..507a71b 100644
--- a/modules/shepherd/service/timer.scm
+++ b/modules/shepherd/service/timer.scm
@@ -715,8 +715,15 @@ constructor was given by @code{make-timer-destructor}."
 (define (trigger-timer timer)
   "Trigger the action associated with @var{timer} as if it had reached its
 next calendar event."
-  (local-output (l10n "Triggering timer."))
-  (put-message (timer-channel timer) 'timeout))
+  (if timer
+      (begin
+        (local-output (l10n "Triggering timer."))
+        (put-message (timer-channel timer) 'timeout))
+
+      ;; Properly report situations like 'herd trigger S' when S is stopped
+      ;; and thus has a running value of #f.
+      (local-output (l10n "Attempted to trigger a timer that is not running; \
+doing nothing."))))
 
 (define timer-trigger-action
   (action 'trigger trigger-timer



reply via email to

[Prev in Thread] Current Thread [Next in Thread]