Fork a child process.

def forkexec(argv, env=None):
    """Fork a child process."""
    child_pid = os.fork()
    if child_pid == 0:
        os.closerange(3, MAXFD)
        environ = os.environ.copy()
        if env is not None:
            environ.update(env)
        os.execve(argv[0], argv, environ)
    return child_pid