fix stdout redirection conditionally for windows