commit c837ae17078f26cffc2e3d5c45324587c584d7b0 (tree)
parent fca1d53625281f763f628fc8b2f41d22bef29c57
Author: Andrew Kelley <superjoe30@gmail.com>
Date: Sun, 15 Oct 2017 18:25:39 -0400
set stdout and stderr to binary mode on windows
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/os.cpp b/src/os.cpp
@@ -25,6 +25,7 @@
#include <windows.h>
#include <io.h>
+#include <fcntl.h>
typedef SSIZE_T ssize_t;
#else
@@ -59,7 +60,6 @@ static clock_serv_t cclock;
// implementation in the zig standard library and then this code all gets
// deleted when we self-host. it works for now.
-
#if defined(ZIG_OS_POSIX)
static void populate_termination(Termination *term, int status) {
if (WIFEXITED(status)) {
@@ -887,6 +887,10 @@ int os_make_dir(Buf *path) {
int os_init(void) {
srand((unsigned)time(NULL));
#if defined(ZIG_OS_WINDOWS)
+ _setmode(fileno(stdout), _O_BINARY);
+ _setmode(fileno(stderr), _O_BINARY);
+#endif
+#if defined(ZIG_OS_WINDOWS)
unsigned __int64 frequency;
if (QueryPerformanceFrequency((LARGE_INTEGER*) &frequency)) {
win32_time_resolution = 1.0 / (double) frequency;