我刚刚使用RailsInstaller Ruby 2.1重新安装了 rails
在我进行了捆绑安装并且一切都成功之后,我尝试启动 spring 并收到以下错误:
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/spring-1.3.3/lib/spring/sid.rb:33:in ``': No such file or directory
- ps -p 1108 -o sess= (Errno::ENOENT)
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/spring-1.3.3/lib/spring/sid.rb:33:in `sid'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/spring-1.3.3/lib/spring/sid.rb:39:in `pgid'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/spring-1.3.3/lib/spring/server.rb:78:in `set_pgid'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/spring-1.3.3/lib/spring/server.rb:34:in `boot'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/spring-1.3.3/lib/spring/server.rb:14:in `boot'
from -e:1:in `<main>'
这是我的 sid.rb 文件的样子
begin
# If rubygems is present, keep it out of the way when loading fiddle,
# otherwise if fiddle is not installed then rubygems will load all
# gemspecs in its (futile) search for fiddle, which is slow.
if respond_to?(:gem_original_require, true)
gem_original_require 'fiddle'
else
require 'fiddle'
end
rescue LoadError
end
module Spring
module SID
def self.fiddle_func
@fiddle_func ||= Fiddle::Function.new(
DL::Handle::DEFAULT['getsid'],
[Fiddle::TYPE_INT],
Fiddle::TYPE_INT
)
end
def self.sid
@sid ||= begin
if Process.respond_to?(:getsid)
# Ruby 2
Process.getsid
elsif defined?(Fiddle) and defined?(DL)
# Ruby 1.9.3 compiled with libffi support
fiddle_func.call(0)
else
# last resort: shell out
`ps -p #{Process.pid} -o sess=`.to_i
end
end
end
def self.pgid
Process.getpgid(sid)
end
end
end
我想真正的错误是它无法在这里获得 sid:
if Process.respond_to?(:getsid)
# Ruby 2
Process.getsid
但我不知道该怎么做。我使用的是最新版本的 spring 1.3.3。
谢谢,