hooks: regression fix of introduced deadlock.

[`Popen.wait`](https://docs.python.org/2/library/subprocess.html#subprocess.Popen.wait) may hang. @lnielsen-cern did it correctly the first time... I pledge guilty.