From 947d0bc43cd8ffe0b4fdcc6967e9b348d7d829e2 Mon Sep 17 00:00:00 2001 From: Meivyn <793322+Meivyn@users.noreply.github.com> Date: Sat, 19 Nov 2022 23:06:34 -0500 Subject: [PATCH] Potentially fix a Win32Exception when restarting the game --- IPA.Loader/Logging/StdoutInterceptorPipes.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/IPA.Loader/Logging/StdoutInterceptorPipes.cs b/IPA.Loader/Logging/StdoutInterceptorPipes.cs index a58f3fe3..041e5996 100644 --- a/IPA.Loader/Logging/StdoutInterceptorPipes.cs +++ b/IPA.Loader/Logging/StdoutInterceptorPipes.cs @@ -23,7 +23,9 @@ namespace IPA.Logging private static void InitializePipe(int stdHandle) { - var pipeName = stdHandle == STD_OUTPUT_HANDLE ? "STD_OUT_PIPE" : "STD_ERR_PIPE"; + // Makes sure that we won't get a ERROR_PIPE_BUSY Win32Exception + // if the pipe wasn't closed fast enough when restarting the game. + var pipeName = Guid.NewGuid().ToString(); var serverThread = InstantiateServerThread(pipeName, stdHandle); serverThread.Start(); var clientThread = InstantiateClientThread(pipeName, stdHandle);