aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authorPrathamesh Sonpatki <csonpatki@gmail.com>2016-03-30 10:41:41 +0530
committerPrathamesh Sonpatki <csonpatki@gmail.com>2016-03-30 11:20:15 +0530
commit9d87ce34f865fa9d7a24ef9f1f1b0d4dedfd3fbf (patch)
treeb31cc37249b76d6e908c57746019857698ea38fa /railties/lib
parentafba03f79c9e3e88fbb9e38dbb905546f16f0d9e (diff)
downloadrails-9d87ce34f865fa9d7a24ef9f1f1b0d4dedfd3fbf.tar.gz
rails-9d87ce34f865fa9d7a24ef9f1f1b0d4dedfd3fbf.tar.bz2
rails-9d87ce34f865fa9d7a24ef9f1f1b0d4dedfd3fbf.zip
Fix rails restart issue with Puma
- We need to pass the restart command to Puma so that it will use it while restarting the server. - Also made sure that all the options passed by user while starting the server are used in the generated restart command so that they will be used while restarting the server. - Besides that we need to remove the server.pid file for the previous running server because otherwise Rack complains about it's presence. - We don't care if the server.pid file does not exist. We only want to delete it if it exists. - This also requires some changes on Puma side which are being tracked here - https://github.com/puma/puma/pull/936. - Fixes #23910.
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/rails/commands/server.rb7
-rw-r--r--railties/lib/rails/dev_caching.rb1
-rw-r--r--railties/lib/rails/tasks/restart.rake1
3 files changed, 8 insertions, 1 deletions
diff --git a/railties/lib/rails/commands/server.rb b/railties/lib/rails/commands/server.rb
index c2434d62e2..7418dff18b 100644
--- a/railties/lib/rails/commands/server.rb
+++ b/railties/lib/rails/commands/server.rb
@@ -94,7 +94,8 @@ module Rails
environment: (ENV['RAILS_ENV'] || ENV['RACK_ENV'] || "development").dup,
daemonize: false,
caching: nil,
- pid: Options::DEFAULT_PID_PATH
+ pid: Options::DEFAULT_PID_PATH,
+ restart_cmd: restart_command
})
end
@@ -130,5 +131,9 @@ module Rails
Rails.logger.extend(ActiveSupport::Logger.broadcast(console))
end
end
+
+ def restart_command
+ "bin/rails server #{ARGV.join(' ')}"
+ end
end
end
diff --git a/railties/lib/rails/dev_caching.rb b/railties/lib/rails/dev_caching.rb
index 4760010851..3c20164f0f 100644
--- a/railties/lib/rails/dev_caching.rb
+++ b/railties/lib/rails/dev_caching.rb
@@ -15,6 +15,7 @@ module Rails
end
FileUtils.touch 'tmp/restart.txt'
+ FileUtils.rm_f('tmp/pids/server.pid')
end
def enable_by_argument(caching)
diff --git a/railties/lib/rails/tasks/restart.rake b/railties/lib/rails/tasks/restart.rake
index f36c86d81b..7e15bb55a1 100644
--- a/railties/lib/rails/tasks/restart.rake
+++ b/railties/lib/rails/tasks/restart.rake
@@ -2,4 +2,5 @@ desc "Restart app by touching tmp/restart.txt"
task :restart do
FileUtils.mkdir_p('tmp')
FileUtils.touch('tmp/restart.txt')
+ FileUtils.rm_f('tmp/pids/server.pid')
end