Created
October 14, 2008 20:42
-
-
Save diclophis/16785 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.daemon | |
IO.popen("python /root/isk-daemon-0.6.2/isk-daemon.py 2>&1") { |io| | |
i = "" | |
thread = Thread.new { | |
while IO.select([io], nil, nil) do | |
i = io.gets | |
puts i | |
break if i.nil? | |
end | |
} | |
sleep 0.1 until i.include?("init finished") | |
begin | |
yield | |
rescue => problem | |
raise problem | |
ensure | |
self.shutdown | |
thread.join | |
end | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment