当我尝试运行红宝石的应用程序,它提供了以下错误,红宝石给出了“没有这样的文件或目录 - 的text.txt(错误:: ENOENT)”错误
任何人都可以把一些光给它。
ruby logger.rb
/home/swapnasa/Downloads/irclogger-master
logger.rb:14:in `read': No such file or directory - ./tmp/logger.pid (Errno::ENOENT)
from logger.rb:14:in `<main>'
代码放在这里:
#!/usr/bin/env ruby
puts Dir.pwd
$: << File.join(File.dirname(__FILE__), 'lib')
require 'irclogger'
require 'irclogger/cinch_plugin'
require 'redis'
pidfile = File.join(File.dirname(__FILE__), 'tmp', 'logger.pid')
begin
old_pid = File.read(pidfile).to_i
Process.kill 0, old_pid
raise "An existing logger process is running with pid #{old_pid}. Refusing to start"
rescue Errno::ESRCH
end
File.open(pidfile, 'w') do |f|
f.write Process.pid
end
bot = Cinch::Bot.new do
configure do |c|
c.server = Config['server']
c.channels = Config['channels']
c.user = Config['username']
c.nick = Config['nickname']
c.realname = Config['realname']
# cinch, oh god why?!
c.plugins.plugins = [IrcLogger::CinchPlugin]
end
end
IrcLogger::CinchPlugin.redis = Redis.new(url: Config['redis'])
bot.start
好像你试图打开不存在的文件... – piokuc
可能是愚蠢的......我就是这样做来解决这个问题,我已经在手动tmp目录中创建logger.pid,然后重新启动应用程序然后它工作。 – phulei
发现它的一个错误。现在它的固定。 – phulei