From 93b42f62ece1ad5181ed1119fc750bcbb74c5d3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= Date: Sat, 14 Oct 2017 22:45:55 +0800 Subject: [PATCH] guix: substitute: Report the last process in the child process. Fixes . * guix/utils.scm (filtered-port): Close the 'input' port in the child process. * guix/scripts/substitute.scm (progress-substitution): Close the 'progress' port before 'restore-file'. --- guix/scripts/substitute.scm | 10 ++++++---- guix/utils.scm | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm index 921a7c679..d175d3e84 100755 --- a/guix/scripts/substitute.scm +++ b/guix/scripts/substitute.scm @@ -959,16 +959,18 @@ DESTINATION as a nar file. Verify the substitute against ACL." (decompressed-port (and=> (narinfo-compression narinfo) string->symbol) progress))) + ;; A child process of 'decompressed-port' will read from this 'process' + ;; port and thus report the actual progress to the console. As the + ;; parent process, we should close it at the start. + (close-port progress) ;; Unpack the Nar at INPUT into DESTINATION. (restore-file input destination) (close-port input) - (close-port progress) + (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 de4aa6531..f8cf11ccb 100644 --- a/guix/utils.scm +++ b/guix/utils.scm @@ -153,6 +153,7 @@ buffered data is lost." (close-port in) (dump-port input out)) (lambda () + (close input) (false-if-exception (close out)) (primitive-_exit 0)))) (child -- 2.13.3