~ chicken-core (master) 47b99e5d125f256426109725ac3d0a5dee56842a


commit 47b99e5d125f256426109725ac3d0a5dee56842a
Author:     Mario Domenech Goulart <mario@parenteses.org>
AuthorDate: Sun Nov 16 18:48:41 2025 +0100
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Mon Nov 17 10:12:05 2025 +0100

    egg-download.scm: Handle empty files
    
    In case of oef (what read-bytevector returns on empty files), use
    display to write the empty string instead of write-bytevector, which
    expects a bytevector as input.
    
    Signed-off-by: felix <felix@call-with-current-continuation.org>

diff --git a/egg-download.scm b/egg-download.scm
index 512fa384..0e1f51da 100644
--- a/egg-download.scm
+++ b/egg-download.scm
@@ -189,7 +189,10 @@
 	               (_ (d "  ~a (~a bytes)~%" name size))
 	      	       (data (read-bytevector size in)) )
 		  (with-output-to-file (make-pathname dest name)
-                    (lambda () (write-bytevector data))
+                    (lambda ()
+                      (if (eof-object? data)
+                          (display "")
+                          (write-bytevector data)))
                     #:binary ) )
 		(get-files (cons name files)) ) ) ) ) ))
 
Trap