guix-commits
[Top][All Lists]
Advanced

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

55/80: installer: Close unused ports in pipe-cmd.


From: John Darrington
Subject: 55/80: installer: Close unused ports in pipe-cmd.
Date: Tue, 3 Jan 2017 15:49:44 +0000 (UTC)

jmd pushed a commit to branch wip-installer
in repository guix.

commit 91eaa52b2ba27ee2abf17bf2c136fdf9a2f5d511
Author: John Darrington <address@hidden>
Date:   Thu Dec 29 19:18:52 2016 +0100

    installer: Close unused ports in pipe-cmd.
    
    * gnu/system/installer/utils.scm (pipe-cmd): Close all unused ports.
---
 gnu/system/installer/utils.scm |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/gnu/system/installer/utils.scm b/gnu/system/installer/utils.scm
index 8623169..04f53ab 100644
--- a/gnu/system/installer/utils.scm
+++ b/gnu/system/installer/utils.scm
@@ -77,23 +77,22 @@
 
 (define* (pipe-cmd ipipe cmd #:rest args)
   "Run CMD ARGS ... sending stdout and stderr to IPIPE.  Returns the exit 
status of CMD."
-  (let* (
-        (pipep (pipe))
+  (let* ((pipep (pipe))
         (pid (primitive-fork)))
-
     (if (zero? pid)
        (begin
+          (close-port (car pipep))
          (redirect-port (cdr pipep) (current-output-port))
          (redirect-port (cdr pipep) (current-error-port))
          (apply execlp cmd args))
        (begin
-         (close (cdr pipep))
+         (close-port (cdr pipep))
          (let loop ((c (read-char (car pipep))))
            (unless (eof-object? c)
               (display c ipipe)
               (force-output ipipe)
-              (loop (read-char (car pipep)))))))
-    
+              (loop (read-char (car pipep)))))
+          (close-port (car pipep))))
     (cdr (waitpid pid))))
 
 (define (justify text width)



reply via email to

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