reverted change 7982a8ec0fcb27987cc14033c2fb012e71480851 because wait() by default only waits for terminations, not other signals