diff options
author | Ludovic Courtès <ludo@gnu.org> | 2019-12-06 00:40:41 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2019-12-12 17:56:58 +0100 |
commit | 22f06a212879369bd1d7f3aa5b19f8f89a8c6693 (patch) | |
tree | b843f8fc7130138746872edc2e0f5d5cd838c3d6 /guix/scripts | |
parent | 1d9a4456a83a197a47bf2bdebc6b60ae78e00cfc (diff) |
progress: Add 'progress-report-port'.
* guix/scripts/substitute.scm (progress-report-port): Move to...
* guix/progress.scm (progress-report-port): ... here. New procedure.
Diffstat (limited to 'guix/scripts')
-rwxr-xr-x | guix/scripts/substitute.scm | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm index 4802fbd1fe..7eca2c6874 100755 --- a/guix/scripts/substitute.scm +++ b/guix/scripts/substitute.scm @@ -823,35 +823,6 @@ was found." (= (string-length file) 32))))) (narinfo-cache-directories directory))) -(define (progress-report-port reporter port) - "Return a port that continuously reports the bytes read from PORT using -REPORTER, which should be a <progress-reporter> object." - (match reporter - (($ <progress-reporter> start report stop) - (let* ((total 0) - (read! (lambda (bv start count) - (let ((n (match (get-bytevector-n! port bv start count) - ((? eof-object?) 0) - (x x)))) - (set! total (+ total n)) - (report total) - n)))) - (start) - (make-custom-binary-input-port "progress-port-proc" - read! #f #f - (lambda () - ;; XXX: Kludge! When used through - ;; 'decompressed-port', this port ends - ;; up being closed twice: once in a - ;; child process early on, and at the - ;; end in the parent process. Ignore - ;; the early close so we don't output - ;; a spurious "download-succeeded" - ;; trace. - (unless (zero? total) - (stop)) - (close-port port))))))) - (define-syntax with-networking (syntax-rules () "Catch DNS lookup errors and TLS errors and gracefully exit." |