Hello,
I have a problem with ruby 2.2 + Middleman which calls WEBrick::HTTPServer#start after WEBrick::HTTPServer#stop.
1. Type "middleman server" in shell
2. Modify config.rb
3. Then Middleman tries to restart WEBrick automatically but fails and keep showing the same exception below:
ERROR NoMethodError: undefined method `' for nil:NilClass
/Users/koji/.rbenv/versions/2.2.1/lib/ruby/2.2.0/webrick/server.rb:174:in `block in start'
Meanwhile, it works in ruby 2.1.5.
(Here is a simple code to reproduce: Fix #1430 by recreating WEBrick server instead of reusing by codeout · Pull Request #1475 · middleman/middleman · GitHub)
Doesn't WEBrick support restarting (#start after #stop) any more?
Seems like the API was changed by this commit:
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?revision=48353&view=revision
Author: akr
Date: Sun Nov 9 23:03:40 2014 UTC (3 months, 3 weeks ago)
Changed paths: 3
Log Message:
* lib/webrick/server.rb (initialize): Initialize shutdown pipe here
to avoid race condition.
(cleanup_shutdown_pipe): New private method.
(cleanup_listener): Extracted from shutdown method.
Call this method from start method to avoid race condition.
Thanks
Shintaro Kojima