Sinatra app:
require "rubygems"
require "sinatra"
get '/' do
"Hello world. It's #{Time.now} at the server!"
end
Windows XP最新版本的mongrel,sinatra,霰弹枪。红宝石1.8.6
运行shotgun test_app.rb导致
C:\Files\sites\sinatra>shotgun test.rb
== Shotgun starting Rack::Handler::Mongrel on localhost:9393
Thu Dec 03 16:51:37 -0800 2009: Read error: #<NotImplementedError: fork() functi
on is unimplemented on this machine>
c:/ruby/lib/ruby/gems/1.8/gems/shotgun-0.4/lib/shotgun.rb:26:in `fork'
c:/ruby/lib/ruby/gems/1.8/gems/shotgun-0.4/lib/shotgun.rb:26:in `call!'
c:/ruby/lib/ruby/gems/1.8/gems/shotgun-0.4/lib/shotgun.rb:15:in `call'
c:/ruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/content_length.rb:13:in `call'
c:/ruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/chunked.rb:15:in `call'
c:/ruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/handler/mongrel.rb:61:in `process'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:159:in `process_client'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:158:in `each'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:158:in `process_client'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:285:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:285:in `initialize'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:285:in `new'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:285:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:268:in `initialize'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:268:in `new'
c:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:268:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/handler/mongrel.rb:34:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/shotgun-0.4/bin/shotgun:129
c:/Ruby/bin/shotgun:19:in `load'
c:/Ruby/bin/shotgun:19
有关如何解决此问题的任何想法?谢谢!
答案 0 :(得分:2)
我能做的最好的事情是指向another thread about this。 Shotgun需要fork,它只能在* nix系统上使用。如果您想要提交补丁,还有一些关于如何在本地进行操作的内容。
答案 1 :(得分:2)
一个简单的方法是使用 sinatra / reloader 。安装sinatra/contrib gem并将扩展名添加到主文件中:
require 'sinatra/reloader'
在WIndows 8.1下正常工作。
答案 2 :(得分:1)
您可以尝试restart gem - 它原本打算在Windows上使用,因此它不会使用fork()
。在您的示例中,您只需将 shotgun 替换为重新启动ruby ,如下所示:
restart ruby test_app.rb
有关详细信息,请参阅here - 希望这适合您:)