From fbb145cd079497b8c88197276f92cb89685b4d54 Mon Sep 17 00:00:00 2001 From: Rune Tynan Date: Tue, 20 Feb 2024 16:43:04 -0800 Subject: [PATCH] Fix not closing files when spotless history is returned --- crates/engine_bibtex/src/lib.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/engine_bibtex/src/lib.rs b/crates/engine_bibtex/src/lib.rs index fd97b461d..61efc469c 100644 --- a/crates/engine_bibtex/src/lib.rs +++ b/crates/engine_bibtex/src/lib.rs @@ -333,9 +333,7 @@ pub(crate) fn bibtex_main(ctx: &mut Bibtex<'_, '_>, aux_file_name: &CStr) -> His let res = inner_bibtex_main(ctx, &mut globals, aux_file_name); match res { - Ok(History::Spotless) => (), - Ok(hist) => return hist, - Err(BibtexError::Recover) => { + Err(BibtexError::Recover) | Ok(History::Spotless) => { // SAFETY: bst_file guaranteed valid at this point unsafe { peekable_close(ctx, ctx.bst_file) }; ctx.bst_file = None; @@ -345,6 +343,7 @@ pub(crate) fn bibtex_main(ctx: &mut Bibtex<'_, '_>, aux_file_name: &CStr) -> His ttbc_output_close(ctx.engine, ctx.bbl_file); } Err(BibtexError::Fatal) => (), + Ok(hist) => return hist, } match get_history() {