class Foreman::Engine

def watch_for_termination

def watch_for_termination
  pid, status = Process.wait2
  process = running_processes.delete(pid)
  info "process terminated", process.name
  terminate_gracefully
  kill_all
rescue Errno::ECHILD
end