aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/webrick_server.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/webrick_server.rb')
-rw-r--r--railties/lib/webrick_server.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/railties/lib/webrick_server.rb b/railties/lib/webrick_server.rb
index f356eaf35e..74d5c08488 100644
--- a/railties/lib/webrick_server.rb
+++ b/railties/lib/webrick_server.rb
@@ -66,6 +66,10 @@ class DispatchServlet < WEBrick::HTTPServlet::AbstractServlet
require File.join(@server_options[:server_root], "..", "config", "environment") unless defined?(RAILS_ROOT)
require "dispatcher"
+ if options[:open_in_browser] && RUBY_PLATFORM =~ /darwin/
+ Thread.new { sleep 0.5; `open http://#{options[:ip]}:#{options[:port]}` }
+ end
+
server.start
end