Skip to content

Commit

Permalink
run callbacks in prif_stop and prif_error_stop
Browse files Browse the repository at this point in the history
  • Loading branch information
everythingfunctional committed Dec 10, 2024
1 parent 23b663f commit ee96f7a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/caffeine/program_termination_s.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit ee96f7a

Please sign in to comment.