Implement standard I/O redirection in ExecuteAndWait().