Moved this inside the loop; for some reason using timeout doesn't allow access to the result of the `waitpid2` command...