aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2006-12-25 09:01:41 +0000
committerRick Olson <technoweenie@gmail.com>2006-12-25 09:01:41 +0000
commitc6b4c8d240abbca0d1e62b3544fafda77c40de0c (patch)
tree4c4ea428171c55b315b9d2a27cedc8c0eb320b4a /railties/lib
parente2acd16810a597e9fa3acd6277e8371678cea34a (diff)
downloadrails-c6b4c8d240abbca0d1e62b3544fafda77c40de0c.tar.gz
rails-c6b4c8d240abbca0d1e62b3544fafda77c40de0c.tar.bz2
rails-c6b4c8d240abbca0d1e62b3544fafda77c40de0c.zip
Fix Webrick Daemon dispatching bug regarding a bad current working directory. Closes #4899 [Rick Olson]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5784 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/webrick_server.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/railties/lib/webrick_server.rb b/railties/lib/webrick_server.rb
index b3e28e812b..71ef275ba4 100644
--- a/railties/lib/webrick_server.rb
+++ b/railties/lib/webrick_server.rb
@@ -59,13 +59,15 @@ class DispatchServlet < WEBrick::HTTPServlet::AbstractServlet
server.mount('/', DispatchServlet, options)
trap("INT") { server.shutdown }
-
server.start
end
def initialize(server, options) #:nodoc:
@server_options = options
@file_handler = WEBrick::HTTPServlet::FileHandler.new(server, options[:server_root])
+ # Change to the RAILS_ROOT, since Webrick::Daemon.start does a Dir::cwd("/")
+ # OPTIONS['working_directory'] is an absolute path of the RAILS_ROOT, set in railties/lib/commands/servers/webrick.rb
+ Dir.chdir(OPTIONS['working_directory']) if defined?(OPTIONS) && File.directory?(OPTIONS['working_directory'])
super
end