[Tools] testbot/testagentd: Disable buffering on stderr on Windows.

Francois Gouget fgouget at codeweavers.com
Mon Dec 19 00:58:47 CST 2016


This reduces the risk of losing part of the log in case testagentd
or Windows crashes.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/src/testagentd/platform_windows.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/testbot/src/testagentd/platform_windows.c b/testbot/src/testagentd/platform_windows.c
index 8e00f09..c72cf25 100644
--- a/testbot/src/testagentd/platform_windows.c
+++ b/testbot/src/testagentd/platform_windows.c
@@ -468,5 +468,11 @@ int platform_init(void)
     hdll = GetModuleHandle("ws2_32");
     pgetaddrinfo = (void*)GetProcAddress(hdll, "getaddrinfo");
     pfreeaddrinfo = (void*)GetProcAddress(hdll, "freeaddrinfo");
+
+    /* By default stderr is fully buffered and Windows does not support
+     * line buffering. So disable buffering altogether.
+     */
+    setvbuf(stderr, NULL, _IONBF, 0);
+
     return 1;
 }
-- 
2.10.2



More information about the wine-patches mailing list