guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

05/05: services: herd: 'with-shepherd' no longer leaves an open connecti


From: Ludovic Courtès
Subject: 05/05: services: herd: 'with-shepherd' no longer leaves an open connection.
Date: Sat, 20 Jan 2018 18:24:11 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit 89a26478160dcf90e5df6688a9df21fe993498bf
Author: Ludovic Courtès <address@hidden>
Date:   Sun Jan 21 00:19:24 2018 +0100

    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.
---
 gnu/services/herd.scm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/gnu/services/herd.scm b/gnu/services/herd.scm
index 5c894af..d882c232 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 <address@hidden>
+;;; Copyright © 2016, 2017, 2018 Ludovic Courtès <address@hidden>
 ;;; Copyright © 2017 Mathieu Othacehe <address@hidden>
 ;;;
 ;;; 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?)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]