# spawn_application (PhusionPassenger::Rack::ApplicationSpawner)

    # File lib/phusion_passenger/rack/application_spawner.rb, line 60
            def self.spawn_application(options = {})
                    options = sanitize_spawn_options(options)

                    a, b = UNIXSocket.pair
                    pid = safe_fork(self.class.to_s, true) do
                            a.close

                            file_descriptors_to_leave_open = [0, 1, 2, b.fileno]
                            NativeSupport.close_all_file_descriptors(file_descriptors_to_leave_open)
                            close_all_io_objects_for_fds(file_descriptors_to_leave_open)

                            channel = MessageChannel.new(b)
                            app = nil
                            success = report_app_init_status(channel) do
                                    prepare_app_process('config.ru', options)
                                    app = load_rack_app
                                    after_loading_app_code(options)
                            end
                            if success
                                    start_request_handler(channel, app, false, options)
                            end
                    end
                    b.close
                    Process.waitpid(pid) rescue nil

                    channel = MessageChannel.new(a)
                    unmarshal_and_raise_errors(channel, options["print_exceptions"], "rack")

                    # No exception was raised, so spawning succeeded.
                    return AppProcess.read_from_channel(channel)
            end