Extract the sentinel process running into its own method

Also, extract the chunk of code where we set the new master process's
environment, for OAOOification.