aboutsummaryrefslogtreecommitdiff
path: root/gnu/services
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-01-21 00:19:24 +0100
committerLudovic Courtès <ludo@gnu.org>2018-01-21 00:24:03 +0100
commit89a26478160dcf90e5df6688a9df21fe993498bf (patch)
treeeedc095d135b6771aff92fdd6ee200b22822ccc3 /gnu/services
parent30875d07ef7c970c77ee6117043ad59c16a4e777 (diff)
downloadpatches-89a26478160dcf90e5df6688a9df21fe993498bf.tar
patches-89a26478160dcf90e5df6688a9df21fe993498bf.tar.gz
services: herd: 'with-shepherd' no longer leaves an open connection.
* gnu/services/herd.scm (with-shepherd): Use 'dynamic-wind' and close CONNECTION at the end.
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/herd.scm9
1 files changed, 7 insertions, 2 deletions
diff --git a/gnu/services/herd.scm b/gnu/services/herd.scm
index 5c894af6fd..d882c232cf 100644
--- a/gnu/services/herd.scm
+++ b/gnu/services/herd.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
;;;
;;; This file is part of GNU Guix.
@@ -83,7 +83,12 @@ return the socket."
(define-syntax-rule (with-shepherd connection body ...)
"Evaluate BODY... with CONNECTION bound to an open socket to PID 1."
(let ((connection (open-connection)))
- body ...))
+ (dynamic-wind
+ (const #t)
+ (lambda ()
+ body ...)
+ (lambda ()
+ (close-port connection)))))
(define-condition-type &shepherd-error &error
shepherd-error?)