guix-commits
[Top][All Lists]
Advanced

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

01/01: guix: substitute: Report the last progress in the child process.


From: ???
Subject: 01/01: guix: substitute: Report the last progress in the child process.
Date: Tue, 17 Oct 2017 07:03:54 -0400 (EDT)

iyzsong pushed a commit to branch master
in repository guix.

commit 5efa0e4d4f25485dcf3c520f9f3db9ef126efdf6
Author: 宋文武 <address@hidden>
Date:   Sat Oct 14 22:45:55 2017 +0800

    guix: substitute: Report the last progress in the child process.
    
    Fixes <https://bugs.gnu.org/28756>.
    
    * guix/utils.scm (filtered-port): Close the 'input' port for the current
    process, and close it upon exit in the child process.
    * guix/scripts/substitute.scm (progress-substitution): Display "\n\n" after
    the reporter has finished.
---
 guix/scripts/substitute.scm | 11 +++++++----
 guix/utils.scm              |  2 ++
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index 921a7c6..60dbdb1 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -956,19 +956,22 @@ DESTINATION as a nar file.  Verify the substitute against 
ACL."
                                      #:abbreviation nar-uri-abbreviation)))
                      (progress-report-port reporter raw)))
                   ((input pids)
+                   ;; NOTE: This 'progress' port of current process will be
+                   ;; closed here, while the child process doing the
+                   ;; reporting will close it upon exit.
                    (decompressed-port (and=> (narinfo-compression narinfo)
                                              string->symbol)
                                       progress)))
       ;; Unpack the Nar at INPUT into DESTINATION.
       (restore-file input destination)
       (close-port input)
-      (close-port progress)
+
+      ;; Wait for the reporter to finish.
+      (every (compose zero? cdr waitpid) pids)
 
       ;; Skip a line after what 'progress-reporter/file' printed, and another
       ;; one to visually separate substitutions.
-      (display "\n\n" (current-error-port))
-
-      (every (compose zero? cdr waitpid) pids))))
+      (display "\n\n" (current-error-port)))))
 
 
 ;;;
diff --git a/guix/utils.scm b/guix/utils.scm
index de4aa65..2cf9be3 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -153,9 +153,11 @@ buffered data is lost."
                   (close-port in)
                   (dump-port input out))
                 (lambda ()
+                  (close-port input)
                   (false-if-exception (close out))
                   (primitive-_exit 0))))
              (child
+              (close-port input)
               (close-port out)
               (loop in (cons child pids)))))))))
 



reply via email to

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