Capture exit codes from subprocesses

The functions for creating a new subprocess now accept an additional
`int *` parameter, which you can use to capture the exit code of the
subprocess.