From ee96f7ab67971ca66216d1bb4b0967c355305228 Mon Sep 17 00:00:00 2001 From: Brad Richardson Date: Tue, 10 Dec 2024 11:55:25 -0600 Subject: [PATCH] run callbacks in prif_stop and prif_error_stop --- src/caffeine/program_termination_s.f90 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/caffeine/program_termination_s.f90 b/src/caffeine/program_termination_s.f90 index a58e12cae..68d08b90a 100644 --- a/src/caffeine/program_termination_s.f90 +++ b/src/caffeine/program_termination_s.f90 @@ -25,6 +25,8 @@ end procedure module procedure prif_stop + call prif_sync_all + call run_callbacks(.false._c_bool, quiet, stop_code_int, stop_code_char) if (present(stop_code_char)) then call prif_stop_character(quiet, stop_code_char) @@ -40,8 +42,6 @@ subroutine prif_stop_integer(quiet, stop_code) integer(c_int), intent(in), optional :: stop_code integer(c_int) :: exit_code - call prif_sync_all - if (present(stop_code)) then if (.not. quiet) then write(output_unit, *) "STOP ", stop_code @@ -65,8 +65,6 @@ subroutine prif_stop_character(quiet, stop_code) logical(c_bool), intent(in) :: quiet character(len=*), intent(in) :: stop_code - call prif_sync_all - if (.not. quiet) then write(output_unit, *) "STOP '" // stop_code // "'" flush output_unit @@ -79,6 +77,7 @@ end subroutine prif_stop_character end procedure prif_stop module procedure prif_error_stop + call run_callbacks(.true._c_bool, quiet, stop_code_int, stop_code_char) if (present(stop_code_char)) then call prif_error_stop_character(quiet, stop_code_char) else