我正在使用Ruby Daemons gem为我的Rails项目创建自定义守护进程。唯一的问题是,当我尝试启动守护进程ruby lib/daemons/test_ctl start
时,它会失败并且无法启动。日志文件显示以下输出。
# Logfile created on Wed Oct 22 16:14:23 +0000 2008 by /
*** below you find the most recent exception thrown, this will be likely (but not certainly) the exception that made the application exit abnormally \*\*\*
# MissingSourceFile: no such file to load -- utf8proc_native
*** below you find all exception objects found in memory, some of them may have been thrown in your application, others may just be in memory because they are standard exceptions ***
# NoMemoryError: failed to allocate memory>
# SystemStackError: stack level too deep>
# fatal: exception reentered>
# LoadError: no such file to load -- daemons>
# LoadError: no such file to load -- active_support>
# MissingSourceFile: no such file to load -- lib/string>
# MissingSourceFile: no such file to load -- utf8proc_native>
即使我从rails插件生成守护进程并尝试运行它,这种情况仍然会发生。有人知道如何解决这个问题吗?
$: << Dir.pwd
这将当前工作目录显式地添加到Ruby的包含路径中。由于某种原因,在使用daemons库时,这是必需的;包含路径看起来很好,但在我添加这个之前并没有起作用。 - dumarequire 'rubygems' require 'daemons' pwd = Dir.pwd Daemons.run_proc('yourserver.rb') do Dir.chdir(pwd) exec "ruby yourserver.rb' end
- duma