[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[shepherd] 02/02: service: 'start-in-parallel' catches 'start' failures.
From: |
Ludovic Courtès |
Subject: |
[shepherd] 02/02: service: 'start-in-parallel' catches 'start' failures. |
Date: |
Wed, 15 Mar 2023 19:02:58 -0400 (EDT) |
civodul pushed a commit to branch master
in repository shepherd.
commit 6aa25f0b8d475d6252aafccdc3d062efc8ca49cf
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Wed Mar 15 11:19:46 2023 +0100
service: 'start-in-parallel' catches 'start' failures.
Previously we'd leave a 'start-in-parallel' fiber behind in the event a
service would fail to start.
* modules/shepherd/service.scm (start-in-parallel): Catch
'action-runtime-error?' when calling 'start' and report it.
---
modules/shepherd/service.scm | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm
index 784437d..ce2dcd4 100644
--- a/modules/shepherd/service.scm
+++ b/modules/shepherd/service.scm
@@ -601,8 +601,17 @@ that could not be started."
(for-each (lambda (service)
(spawn-fiber
(lambda ()
- (put-message channel
- (cons service (start service))))))
+ (let ((value
+ (guard (c ((action-runtime-error? c)
+ (local-output
+ (l10n "Exception caught \
+while starting ~a: ~s")
+ service
+ (cons (action-runtime-error-key c)
+ (action-runtime-error-arguments
c)))
+ #f))
+ (start service))))
+ (put-message channel (cons service value))))))
services)
(let loop ((i (length services))
(failures '()))