def init(main_app)
      @main_app = main_app
      options = read_startup_arguments

      # We don't dump PATH info because at this point it's
      # unlikely to be changed.
      dump_ruby_environment
      check_rvm_using_wrapper_script(options)

      PhusionPassenger.require_passenger_lib 'native_support'
      if defined?(NativeSupport)
        NativeSupport.disable_stdio_buffering
      end

      PhusionPassenger.require_passenger_lib 'constants'
      PhusionPassenger.require_passenger_lib 'public_api'
      PhusionPassenger.require_passenger_lib 'debug_logging'
      PhusionPassenger.require_passenger_lib 'platform_info/ruby'
      PhusionPassenger.require_passenger_lib 'platform_info/operating_system'
      PhusionPassenger.require_passenger_lib 'utils/shellwords'
      PhusionPassenger.require_passenger_lib 'ruby_core_enhancements'
      PhusionPassenger.require_passenger_lib 'ruby_core_io_enhancements'
      PhusionPassenger.require_passenger_lib 'request_handler'

      PhusionPassenger.require_passenger_lib 'rack/thread_handler_extension'
      RequestHandler::ThreadHandler.send(:include, Rack::ThreadHandlerExtension)
      Thread.main[:name] = "Main thread"

      load_macos_foundation

      options
    rescue Exception => e
      record_journey_step_end('SUBPROCESS_WRAPPER_PREPARATION', 'STEP_ERRORED')
      record_and_print_exception(e)
      exit exit_code_for_exception(e)
    end
def init(main_app)
      @main_app = main_app
      options = read_startup_arguments

      # We don't dump PATH info because at this point it's
      # unlikely to be changed.
      dump_ruby_environment
      check_rvm_using_wrapper_script(options)

      PhusionPassenger.require_passenger_lib 'native_support'
      if defined?(NativeSupport)
        NativeSupport.disable_stdio_buffering
      end

      PhusionPassenger.require_passenger_lib 'constants'
      PhusionPassenger.require_passenger_lib 'public_api'
      PhusionPassenger.require_passenger_lib 'debug_logging'
      PhusionPassenger.require_passenger_lib 'platform_info/ruby'
      PhusionPassenger.require_passenger_lib 'platform_info/operating_system'
      PhusionPassenger.require_passenger_lib 'utils/shellwords'
      PhusionPassenger.require_passenger_lib 'ruby_core_enhancements'
      PhusionPassenger.require_passenger_lib 'ruby_core_io_enhancements'
      PhusionPassenger.require_passenger_lib 'request_handler'

      PhusionPassenger.require_passenger_lib 'rack/thread_handler_extension'
      RequestHandler::ThreadHandler.send(:include, Rack::ThreadHandlerExtension)
      Thread.main[:name] = "Main thread"

      load_macos_foundation

      options
    rescue Exception => e
      record_journey_step_end('SUBPROCESS_WRAPPER_PREPARATION', 'STEP_ERRORED')
      record_and_print_exception(e)
      exit exit_code_for_exception(e)
    end
To be called by the (pre)loader as soon as possible.