maybe_supervise Subroutine

public subroutine maybe_supervise()

Enter supervisor mode when requested, otherwise return immediately.

If auto-restart is enabled and the current process is not marked as a child (--watch-child), this routine runs a supervisor loop and does not return.

Arguments

None

Calls

proc~~maybe_supervise~~CallsGraph proc~maybe_supervise maybe_supervise proc~parse_restart_flags parse_restart_flags proc~maybe_supervise->proc~parse_restart_flags proc~supervisor_loop supervisor_loop proc~maybe_supervise->proc~supervisor_loop proc~get_arg get_arg proc~parse_restart_flags->proc~get_arg proc~get_restart_defaults get_restart_defaults proc~parse_restart_flags->proc~get_restart_defaults proc~parse_int parse_int proc~parse_restart_flags->proc~parse_int proc~parse_real parse_real proc~parse_restart_flags->proc~parse_real proc~set_low_cpu set_low_cpu proc~parse_restart_flags->proc~set_low_cpu proc~starts_with~2 starts_with proc~parse_restart_flags->proc~starts_with~2 proc~build_child_command build_child_command proc~supervisor_loop->proc~build_child_command proc~sleep_seconds sleep_seconds proc~supervisor_loop->proc~sleep_seconds proc~build_child_command->proc~get_arg proc~build_child_command->proc~starts_with~2 proc~choose_self_exe choose_self_exe proc~build_child_command->proc~choose_self_exe proc~quote_arg quote_arg proc~build_child_command->proc~quote_arg proc~load_watch_table load_watch_table proc~get_restart_defaults->proc~load_watch_table proc~toml_get_int toml_get_int proc~get_restart_defaults->proc~toml_get_int proc~toml_get_logical toml_get_logical proc~get_restart_defaults->proc~toml_get_logical proc~toml_get_real toml_get_real proc~get_restart_defaults->proc~toml_get_real proc~toml_get_string toml_get_string proc~get_restart_defaults->proc~toml_get_string proc~sleep_os sleep_os proc~sleep_seconds->proc~sleep_os proc~sleep_spin sleep_spin proc~sleep_seconds->proc~sleep_spin proc~choose_self_exe->proc~get_arg exists exists proc~load_watch_table->exists get_value get_value proc~load_watch_table->get_value read_package_file read_package_file proc~load_watch_table->read_package_file proc~is_windows_os is_windows_os proc~quote_arg->proc~is_windows_os get_os_type get_os_type proc~sleep_os->get_os_type interface~fpm_watch_sleep_seconds fpm_watch_sleep_seconds proc~sleep_os->interface~fpm_watch_sleep_seconds proc~toml_get_int->get_value proc~toml_get_logical->get_value proc~toml_get_real->get_value proc~toml_get_string->get_value proc~is_windows_os->get_os_type

Source Code

   subroutine maybe_supervise()
      logical :: auto_restart, is_child
      real    :: restart_delay
      integer :: restart_max
      character(len=:), allocatable :: self_exe

      call parse_restart_flags(auto_restart, restart_delay, restart_max, is_child, self_exe)

      if (auto_restart .and. (.not. is_child)) then
         call supervisor_loop(max(0.0, restart_delay), restart_max, self_exe)
         stop 0
      end if
   end subroutine maybe_supervise