gooddata/smoker — pull request #3 by fpytloun (2014-02-09 19:15:18+00:00)
Title: Avoid killing innocent processes with re-used PID

util.command.Command will register atexit function that should kill
process tree of given PID during daemon shutdown.
Unfortunately it's not unregistered when PID no longer exist.

Unregister cleanup function when:
* command is done, process does not exist anymore
* process is killed after timeout
* process refused to die, thread is deadlocked -> we can't control it
anymore and ensure process won't die in the future and we won't kill
innocent process anyway

Also be more polite during cleanup and send SIGTERM first, give process
1 second to shutdown properly and after that send SIGKILL.