gorakhargosh/watchdog — pull request #225 by berdario (2014-03-22 21:36:35+00:00)
Title: Terminate all subprocesses

`auto-restart` won't terminate all children processes

```
1e39bb6da6cffe8b dario@macbook /tmp> cat file.py
from subprocess import call
call('python3 -m http.server'.split())
1e39bb6da6cffe8b dario@macbook /tmp>
watchmedo auto-restart -p /tmp/file.py python file.py
Serving HTTP on 0.0.0.0 port 8000 ...
on_any_event(self=, event=)
Traceback (most recent call last):
[SNIP]
OSError: [Errno 98] Address already in use
```

(I stumbled upon this problem with a [Warp](http://hackage.haskell.org/package/warp) server run through the `runhaskell` program, that spawns a `runghc` and a `ghc` process, the dummy file.py is only for your ease to reproduce it)

I'm not storing the result of `os.getpgid(self.process.pid)` because it could change during the execution