Add helper to signal a process and wait for it to terminate.