I'm not sure about this change. If the `chdir` fails, the exception will be thrown in the forked process. Even if we use the C function, we still need to communicate failure somehow to the original process. Checking for the directory's existence in the main process is out as it would be a race condition.