From 3eeae8d365385a0607eee62b1dfa4950289599d4 Mon Sep 17 00:00:00 2001 From: Nikita Smith Date: Sat, 11 Jul 2026 12:27:53 -0700 Subject: [PATCH] enable binary for stdout and stderr to bypass CRLF mangling issues in captured output under build systems --- src/linker/lnk_log.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/linker/lnk_log.c b/src/linker/lnk_log.c index c15abb0e..5dce5875 100644 --- a/src/linker/lnk_log.c +++ b/src/linker/lnk_log.c @@ -1,6 +1,11 @@ // Copyright (c) Epic Games Tools // Licensed under the MIT license (https://opensource.org/license/mit/) +#if OS_WINDOWS +#include // _O_BINARY +#include // _setmode +#endif + static Mutex g_log_mutex; static B32 g_log_status [LNK_Log_Count]; static LNK_ErrorMode g_error_mode_arr [LNK_Error_Count]; @@ -36,7 +41,14 @@ lnk_log_begin(void) for (int i = LNK_Error_StopFirst; i < LNK_Error_StopLast; ++i) { g_error_mode_arr[i] = LNK_ErrorMode_Stop; } for (int i = LNK_Error_ContinueFirst; i < LNK_Error_ContinueLast; ++i) { g_error_mode_arr[i] = LNK_ErrorMode_Continue; } for (int i = LNK_Warning_First; i < LNK_Warning_Last; ++i) { g_error_mode_arr[i] = LNK_ErrorMode_Warn; } + g_log_mutex = mutex_alloc(); + + // ninja mangles CRLF in captured linker output, so force LF-only output +#if OS_WINDOWS + _setmode(_fileno(stdout), _O_BINARY); + _setmode(_fileno(stderr), _O_BINARY); +#endif } internal void