[#5330] Ensure wait() is called on git processes