Windows: avoid using pipe code for file redirection

When Racket is run with stdout or stderr redirected to a file,
then it must be treated as a regular file, otherwise flushing
and position counting doesn't work right.

Merge to v6.8
This commit is contained in:
Matthew Flatt 2017-01-11 06:38:25 -08:00
parent 286e5bebed
commit a860791d6f

View File

@ -8450,7 +8450,10 @@ make_fd_output_port(intptr_t fd, Scheme_Object *name, int regfile, int win_textm
#ifdef WINDOWS_FILE_HANDLES
/* Character devices can't block output, right? */
if (is_fd_terminal(fop->fd))
if (!regfile && is_fd_terminal(fop->fd))
regfile = 1;
/* It's important to not use pipe code for flushing to file handles: */
if (!regfile && (GetFileType((HANDLE)fop->fd) == FILE_TYPE_DISK))
regfile = 1;
/* The work thread is created on demand in fd_flush. */
#endif