Skip to content

Instantly share code, notes, and snippets.

@auxesis
Created September 10, 2011 13:25
Show Gist options
  • Select an option

  • Save auxesis/1208298 to your computer and use it in GitHub Desktop.

Select an option

Save auxesis/1208298 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
def kill_lingering_daemons
@daemons && @daemons.each do |pipe|
Process.kill("KILL", pipe.pid)
end
end
def spawn_daemon(command)
puts command
@daemons ||= []
daemon = IO.popen(command)
@daemons << daemon
daemon
sleep 1.5
end
at_exit do
kill_lingering_daemons
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment