How to prevent Git client hanging during post-receive hook

I believe that either python source/some_script.py --param=value or pip install leaves a hanging child process.

From my experiments, I guess git has some server-side logic to wait for all the children processes left over by the post-receive script. It waits for a hanging child forever.

Please verify your prediction that the post-receive script always completely finishes: run manually post-receive in the shell, then look up the children with ps