More versatile treatment of subprocesses for t_main
This should catch bugs like e8537f80c47dfa05da1ce082532b73665d48c753 in the future.