mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 15:36:20 -05:00
service: shepherd: Guard against exceptions raised by 'start'.
Fixes <http://bugs.gnu.org/22548>. Reported by Albin <albin@fripost.org>, Mark H Weaver, and Alex Kost. * gnu/services/shepherd.scm (shepherd-configuration-file)[config]: Guard against 'service-error?'.
This commit is contained in:
parent
1d6b7d5847
commit
081bd3bd29
1 changed files with 12 additions and 2 deletions
|
@ -234,7 +234,8 @@ (define config
|
|||
(set! %load-compiled-path
|
||||
(cons #$compiled %load-compiled-path)))
|
||||
|
||||
(use-modules (system repl error-handling))
|
||||
(use-modules (srfi srfi-34)
|
||||
(system repl error-handling))
|
||||
|
||||
;; Arrange to spawn a REPL if loading one of FILES fails. This is
|
||||
;; better than a kernel panic.
|
||||
|
@ -246,7 +247,16 @@ (define config
|
|||
(setenv "PATH" "/run/current-system/profile/bin")
|
||||
|
||||
(format #t "starting services...~%")
|
||||
(for-each start
|
||||
(for-each (lambda (service)
|
||||
;; In the Shepherd 0.3 the 'start' method can raise
|
||||
;; '&action-runtime-error' if it fails, so protect
|
||||
;; against it. (XXX: 'action-runtime-error?' is not
|
||||
;; exported is 0.3, hence 'service-error?'.)
|
||||
(guard (c ((service-error? c)
|
||||
(format (current-error-port)
|
||||
"failed to start service '~a'~%"
|
||||
service)))
|
||||
(start service)))
|
||||
'#$(append-map shepherd-service-provision
|
||||
(filter shepherd-service-auto-start?
|
||||
services)))))
|
||||
|
|
Loading…
Reference in a new issue