leave none of an output a failure stopped writing

A failed -C -o left the file truncated, which make would take for done.
This commit is contained in:
2026-10-19 10:23:59 +03:00
parent 7118dac3cf
commit e5b2342ffa
2 changed files with 14 additions and 3 deletions

View File

@@ -168,8 +168,12 @@
(define (write-to-file-or-stdout output what)
(if (stdout-output? output)
(what)
(with-output-to-file output
(fn (what)))))
;; a failure part way through leaves none of the file, which make
;; would take for done
(handle-exceptions exn
(begin (delete-file* output) (abort exn))
(with-output-to-file output
(fn (what))))))
(define (emit-c-or-sex sex-forms output args)
(write-to-file-or-stdout output