Permalink
Browse files

Improved code readability

  • Loading branch information...
1 parent accc79a commit 8c8fdf6006f9ba0da4bae85f4b6e71fea70203c9 @veloper committed Mar 1, 2014
Showing with 6 additions and 3 deletions.
  1. +6 −3 lib/zeusd/daemon.rb
View
9 lib/zeusd/daemon.rb
@@ -42,15 +42,18 @@ def stop!
(zeus_socket_file.delete rescue nil) if zeus_socket_file.exist?
# Check for remaining processes
- if[process, process.descendants].flatten.select(&:alive?).any?
- raise DaemonException, "Unable to KILL processes: " + alive_processes.join(', ')
- end
+ living_processes = processes.select(&:alive?)
+ raise DaemonException, "Unable to KILL processes: " + living_processes.join(', ') if living_processes.any?
@process = nil
self
end
+ def processes
+ process ? [process, process.descendants].flatten : []
+ end
+
def process
@process ||= Process.all.find {|p| !!p.command[/zeus.*start$/] && p.cwd == cwd }
end

0 comments on commit 8c8fdf6

Please sign in to comment.