scribble: discard partial output on exception
This change avoids the problem of a bad "index.html" on a doucment rendering error, where the presense of an "index.html" would count as successes on a retry. original commit: e4e8a69e06863b423f4b7b716b369b002c2deea1
This commit is contained in:
parent
4291016987
commit
2a67912028
|
@ -247,6 +247,18 @@
|
||||||
(define (part-parent d ri)
|
(define (part-parent d ri)
|
||||||
(collected-info-parent (part-collected-info d ri)))
|
(collected-info-parent (part-collected-info d ri)))
|
||||||
|
|
||||||
|
(define (with-output-to-file/clean fn thunk)
|
||||||
|
;; We use 'replace instead of the usual 'truncate/replace
|
||||||
|
;; to avoid problems where a filename changes only in case,
|
||||||
|
;; in which case some platforms will see the old file
|
||||||
|
;; as matching the new name, while others don't. Replacing
|
||||||
|
;; the file syncs the case with the current uses.
|
||||||
|
(with-handlers ([exn? ; delete file on breaks, too
|
||||||
|
(lambda (exn)
|
||||||
|
(delete-file fn)
|
||||||
|
(raise exn))])
|
||||||
|
(with-output-to-file fn #:exists 'replace thunk)))
|
||||||
|
|
||||||
;; ----------------------------------------
|
;; ----------------------------------------
|
||||||
;; main mixin
|
;; main mixin
|
||||||
|
|
||||||
|
@ -1808,8 +1820,9 @@
|
||||||
;; install files for each directory
|
;; install files for each directory
|
||||||
(install-extra-files ds)
|
(install-extra-files ds)
|
||||||
(let ([fn (build-path fn "index.html")])
|
(let ([fn (build-path fn "index.html")])
|
||||||
(with-output-to-file fn #:exists 'truncate/replace
|
(with-output-to-file/clean
|
||||||
(lambda () (render-one d ri fn))))))
|
fn
|
||||||
|
(lambda () (render-one d ri fn))))))
|
||||||
ds
|
ds
|
||||||
fns))
|
fns))
|
||||||
|
|
||||||
|
@ -1841,13 +1854,9 @@
|
||||||
(if p
|
(if p
|
||||||
(build-path (current-subdirectory) p)
|
(build-path (current-subdirectory) p)
|
||||||
(current-subdirectory)))])
|
(current-subdirectory)))])
|
||||||
;; We use 'replace instead of the usual 'truncate/replace
|
(with-output-to-file/clean
|
||||||
;; to avoid problems where a filename changes only in case,
|
full-path
|
||||||
;; in which case some platforms will see the old file
|
(lambda () (render-one-part d ri full-path number)))
|
||||||
;; as matching the new name, while others don't. Replacing
|
|
||||||
;; the file syncs the case with the current uses.
|
|
||||||
(with-output-to-file full-path #:exists 'replace
|
|
||||||
(lambda () (render-one-part d ri full-path number)))
|
|
||||||
null))
|
null))
|
||||||
(parameterize ([on-separate-page-ok #t])
|
(parameterize ([on-separate-page-ok #t])
|
||||||
;; Normal section render
|
;; Normal section render
|
||||||
|
|
Loading…
Reference in New Issue
Block a user