From 1d6b7d584736ff0ad9e852a39c7c151e10713580 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 5 Feb 2016 11:39:27 +0100 Subject: guix system: Simply warn if we cannot talk to the shepherd. Before that 'open-connection' would return #f, and thus 'current-services' would return a single #f value when its continuation expects two. Reported by calher on #guix. * gnu/services/herd.scm (open-connection): Rethrow system-error exceptions. (with-shepherd): Expect CONNECTION to always be true; remove useless 'dynamic-wind'. * guix/scripts/system.scm (warn-on-system-error): New macro. (upgrade-shepherd-services): Wrap body in 'warn-on-system-error'. --- gnu/services/herd.scm | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'gnu/services') diff --git a/gnu/services/herd.scm b/gnu/services/herd.scm index 89a93a1969..a3a9bf0230 100644 --- a/gnu/services/herd.scm +++ b/gnu/services/herd.scm @@ -52,20 +52,14 @@ return the socket." (connect sock address) (setvbuf sock _IOFBF 1024) sock) - (lambda (key proc format-string format-args errno . rest) - (warning (_ "cannot connect to ~a: ~a~%") file - (apply format #f format-string format-args)) - #f))))) + (lambda args + (close-port sock) + (apply throw args)))))) (define-syntax-rule (with-shepherd connection body ...) "Evaluate BODY... with CONNECTION bound to an open socket to PID 1." (let ((connection (open-connection))) - (and connection - (dynamic-wind - (const #t) - (lambda () - body ...) - (const #t))))) + body ...)) (define (report-action-error error) "Report ERROR, an sexp received by a shepherd client in reply to COMMAND, a -- cgit v1.2.3