use waitFor() to make sure the process exit status is available