testsuite: use binary mode for stdout on Windows

It's much easier than adjusting the test logic to account for the extra \r.
This commit is contained in:
Руслан Ижбулатов 2019-02-08 20:15:19 +00:00 committed by Philip Withnall
parent 16dc979d0e
commit fb37239b20

View File

@ -17,6 +17,11 @@
*/
#include <glib.h>
#ifdef G_OS_WIN32
#include <fcntl.h>
#include <io.h>
#include <stdio.h>
#endif
static void
test_pass (void)
@ -47,6 +52,14 @@ main (int argc,
{
char *argv1;
#ifdef G_OS_WIN32
/* Windows opens std streams in text mode, with \r\n EOLs.
* Sometimes it's easier to force a switch to binary mode than
* to account for extra \r in testcases.
*/
setmode (fileno (stdout), O_BINARY);
#endif
g_return_val_if_fail (argc > 1, 1);
argv1 = argv[1];