close port in compile-whole-program and compile-whole-library

original commit: ed4b7cff2e075c1da0880fc5e2f4491503f9f031
This commit is contained in:
Oscar Waddell 2019-09-25 11:41:52 -04:00
parent 899a688bb0
commit 6ba371fb8d
2 changed files with 17 additions and 15 deletions

3
LOG
View File

@ -1756,3 +1756,6 @@
argument-type-check error messages, for Windows multibyte->string argument-type-check error messages, for Windows multibyte->string
and string->multibyte. and string->multibyte.
primvars.ms primvars.ms
- used with-object-file to restore accidentally dropped close-port in
compile-whole-program and compile-whole-library
compile.ss

View File

@ -1495,9 +1495,8 @@
(define finish-compile (define finish-compile
(lambda (who msg ifn ofn hash-bang-line x1) (lambda (who msg ifn ofn hash-bang-line x1)
(let ([op ($open-file-output-port who ofn (file-options replace))]) (with-object-file who ofn #f
(on-reset (delete-file ofn #f) (lambda (op)
(on-reset (close-port op)
(with-coverage-file who ofn (with-coverage-file who ofn
(lambda (source-table) (lambda (source-table)
(when hash-bang-line (put-bytevector op hash-bang-line)) (when hash-bang-line (put-bytevector op hash-bang-line))
@ -1509,7 +1508,7 @@
(when source-table ($insert-profile-src! source-table x1)) (when source-table ($insert-profile-src! source-table x1))
(emit-header op (constant machine-type)) (emit-header op (constant machine-type))
(let-values ([(rcinfo* final*) (compile-file-help1 x1 msg)]) (let-values ([(rcinfo* final*) (compile-file-help1 x1 msg)])
(compile-file-help2 op (list rcinfo*) (list final*))))))))))) (compile-file-help2 op (list rcinfo*) (list final*))))))))))
(define write-wpo-file (define write-wpo-file
(lambda (who ofn ir*) (lambda (who ofn ir*)