class Passenger::Railz::FrameworkSpawner
def spawn_application(app_root, lower_privilege = true, lowest_user = "nobody", environment = "production")
- ApplicationSpawner::Error: The ApplicationSpawner server exited unexpectedly.
- AppInitError: The application raised an exception or called exit() during startup.
- ArgumentError: +app_root+ doesn't appear to be a valid Ruby on Rails application root.
- AbstractServer::ServerNotStarted: The FrameworkSpawner server hasn't already been started.
Raises:
- Reload the application by calling reload with the correct app_root argument.
- Restart this FrameworkSpawner by calling AbstractServer#stop, then AbstractServer#start.
the application's code, you must do one of these things:
speed up future spawning attempts. This implies that, if you've changed
FrameworkSpawner will internally cache the code of applications, in order to
+lowest_user+ and +environment+ parameters.
See ApplicationSpawner.new for an explanation of the +lower_privilege+,
the spawned RoR application.
When successful, an Application object will be returned, which represents
version associated with this FrameworkSpawner.
Spawn a RoR application using the Ruby on Rails framework
def spawn_application(app_root, lower_privilege = true, lowest_user = "nobody", environment = "production") app_root = normalize_path(app_root) assert_valid_app_root(app_root) exception_to_propagate = nil begin server.write("spawn_application", app_root, lower_privilege, lowest_user, environment) result = server.read if result.nil? raise IOError, "Connection closed" end if result[0] == 'exception' raise unmarshal_exception(server.read_scalar) else pid, listen_socket_name, using_abstract_namespace = server.read if pid.nil? raise IOError, "Connection closed" end owner_pipe = server.recv_io return Application.new(app_root, pid, listen_socket_name, using_abstract_namespace == "true", owner_pipe) end rescue SystemCallError, IOError, SocketError => e raise Error, "The framework spawner server exited unexpectedly" end end