guix-commits
[Top][All Lists]
Advanced

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

[shepherd] 02/06: herd: Factorize 'live-service-failing?'.


From: Ludovic Courtès
Subject: [shepherd] 02/06: herd: Factorize 'live-service-failing?'.
Date: Wed, 26 Apr 2023 18:10:18 -0400 (EDT)

civodul pushed a commit to branch master
in repository shepherd.

commit 274e63e895322f8bb440e9d8e9396ae78732ece3
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Wed Apr 26 15:01:43 2023 +0200

    herd: Factorize 'live-service-failing?'.
    
    * modules/shepherd/scripts/herd.scm (live-service-failing?): New
    procedure.
    (display-status-summary): Use it.
---
 modules/shepherd/scripts/herd.scm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules/shepherd/scripts/herd.scm 
b/modules/shepherd/scripts/herd.scm
index 654cafe..8aa62b3 100644
--- a/modules/shepherd/scripts/herd.scm
+++ b/modules/shepherd/scripts/herd.scm
@@ -55,6 +55,11 @@
   "Return the 'canonical name' of @var{service}."
   (first (live-service-provision service)))
 
+(define (live-service-failing? service)
+  "Return true if @var{service} failed to start."
+  (and (eq? 'stopped (live-service-status service))
+       (pair? (live-service-startup-failures service))))
+
 (define (live-service-status-predicate status)
   "Return a predicate that returns true when passed a service with the given
 @var{status}."
@@ -107,9 +112,7 @@ into a @code{live-service} record."
          (starting (filter (live-service-status-predicate 'starting) services))
          (stopping (filter (live-service-status-predicate 'stopping) services))
          (one-shot stopped (partition live-service-one-shot? stopped))
-         (failing stopped
-                  (partition (compose pair? live-service-startup-failures)
-                             stopped)))
+         (failing stopped  (partition live-service-failing? stopped)))
     (display-services (highlight (l10n "Started:\n")) "+"
                       started)
     (display-services (highlight (l10n "Starting:\n")) "^"



reply via email to

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