I/O Redirection

How does a shell implement output redirection (e.g., ls > output.txt) between fork() and exec()?