Add support for getting a process's exit status.

This ballooned out a bit to also supporting getting the pid, and using
execlp() rather than system() to run the process.
Add a test to ensure wait() returns if called multiple times.