aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-10-06 22:56:27 +0200
committerLudovic Courtès <ludo@gnu.org>2016-10-06 22:59:47 +0200
commitaf0ba938255bb412ad021c19e651e632abd0103c (patch)
tree00e34b5dd782b62b90432c30b63b2964e24e145b
parent59fed2b6093afed0847316fc55a1857d70d77c70 (diff)
downloadpatches-af0ba938255bb412ad021c19e651e632abd0103c.tar
patches-af0ba938255bb412ad021c19e651e632abd0103c.tar.gz
guix system: Return two values when failing to talk to shepherd.
Before that, when 'guix system reconfigure' failed to talk to shepherd and a 'system-error' was raised, we would get a "too few values returned to continuation" error, which would prevent GRUB from being installed. Reported by fps on #guix. * guix/scripts/system.scm (warn-on-system-error): Remove. (with-shepherd-error-handling): Inline former 'warn-on-system-error'. Return two values when 'system-error' is raised.
-rw-r--r--guix/scripts/system.scm25
1 files changed, 10 insertions, 15 deletions
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index a2cd97ac1f..0519ab8c0b 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -227,25 +227,20 @@ BODY..., and restore them."
(set! %load-path path)
(set! %load-compiled-path cpath)))))
-(define-syntax-rule (warn-on-system-error body ...)
- (catch 'system-error
- (lambda ()
- body ...)
- (lambda (key proc format-string format-args errno . rest)
- (warning (_ "while talking to shepherd: ~a~%")
- (apply format #f format-string format-args))
- (with-monad %store-monad
- (return #f)))))
-
(define-syntax-rule (with-shepherd-error-handling mbody ...)
"Catch and report Shepherd errors that arise when binding MBODY, a monadic
expression in %STORE-MONAD."
(lambda (store)
- (warn-on-system-error
- (guard (c ((shepherd-error? c)
- (values (report-shepherd-error c) store)))
- (values (run-with-store store (begin mbody ...))
- store)))))
+ (catch 'system-error
+ (lambda ()
+ (guard (c ((shepherd-error? c)
+ (values (report-shepherd-error c) store)))
+ (values (run-with-store store (begin mbody ...))
+ store)))
+ (lambda (key proc format-string format-args errno . rest)
+ (warning (_ "while talking to shepherd: ~a~%")
+ (apply format #f format-string format-args))
+ (values #f store)))))
(define (report-shepherd-error error)
"Report ERROR, a '&shepherd-error' error condition object."