thuehlinger / daemons

Ruby daemons gem official repository
MIT License
648 stars 71 forks source link

getting error while accessing some external file #34

Closed sunnybogawat closed 9 years ago

sunnybogawat commented 9 years ago

I have created a file called my_server.rb and my_server_crl.rb

in my_server.rb I have following code require './src/abcd.rb'

loop do p "@@@@@@@@ Welcome to Daemon world @@@@@@@@@@@@@" a = ABCD.new a.get_status() sleep(5) end

Here When I am trying to require some external file I am getting error.

sodabrew commented 9 years ago

Daemons is calling Dir.chdir '/' and so your require is no longer relative to your stating point as you are expecting. Use require_relative instead: http://ruby-doc.org/core-1.9.3/Kernel.html#method-i-require_relative