Fixed hang. Runs test-reg correctly, but need to add signal handling for signals other than SIGCHLD.