civodul pushed a commit to branch devel
in repository shepherd.

commit 20f5ddb8a5fd32a37e4b75fbcfde2a3cb14641ba
Author: Ludovic Courtès <[email protected]>
AuthorDate: Sun Jun 2 16:08:44 2024 +0200

    service: ‘start-in-parallel’ expects services, not symbols.
    
    * modules/shepherd/service.scm (start-in-parallel): Expect ‘services’ to
    be a list of services; remove call to ‘lookup-service’.
    (start-service): Adjust accordingly.
    (start-in-the-background): Likewise.
---
 modules/shepherd/service.scm | 39 ++++++++++++++++++---------------------
 1 file changed, 18 insertions(+), 21 deletions(-)

diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 32a09d4..f22faef 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -886,12 +886,7 @@ that could not be started."
   (parameterize ((%one-shot-services-started
                   (or (%one-shot-services-started)
                       (make-hash-table))))
-    (let ((services (map (lambda (service)
-                           (if (symbol? service)
-                               (lookup-service service)
-                               service))
-                         services))
-          (channel  (make-channel)))
+    (let ((channel (make-channel)))
       (for-each (lambda (service)
                   (spawn-fiber
                    (lambda ()
@@ -937,7 +932,8 @@ found in the service registry."
   ;; It is not running; go ahead and launch it.
   (let ((problems
         ;; Resolve all dependencies.
-        (start-in-parallel (service-requirement service))))
+        (start-in-parallel (map lookup-service
+                                 (service-requirement service)))))
     (if (pair? problems)
         (begin
           (for-each (lambda (problem)
@@ -1317,22 +1313,23 @@ This procedure can be useful in a configuration file 
because it lets you
 interact right away with shepherd using the @command{herd} command."
   (spawn-fiber
    (lambda ()
-     (match (start-in-parallel services)
-       (()
-        (local-output
-         (l10n "Successfully started ~a service in the background."
-               "Successfully started ~a services in the background."
-               (length services))
-         (length services)))
-       (failures
-        (local-output
-         (l10n "The following service could not be started in the \
+     (let ((services (map lookup-service services)))
+       (match (start-in-parallel services)
+         (()
+          (local-output
+           (l10n "Successfully started ~a service in the background."
+                 "Successfully started ~a services in the background."
+                 (length services))
+           (length services)))
+         (failures
+          (local-output
+           (l10n "The following service could not be started in the \
 background:~{ ~a~}."
-               "The following services could not be started in the \
+                 "The following services could not be started in the \
 background:~{ ~a~}."
-               (length failures))
-         (delete-duplicates
-          (map service-canonical-name failures)))))))
+                 (length failures))
+           (delete-duplicates
+            (map service-canonical-name failures))))))))
 
   ;; 'spawn-fiber' returns zero values, which can confuse callees; return one.
   *unspecified*)

Reply via email to