|
@ -11,7 +11,7 @@ namespace IPA.Logging |
|
|
{ |
|
|
{ |
|
|
// Used to ensure the server starts first, as Mono struggles with this simple task.
|
|
|
// Used to ensure the server starts first, as Mono struggles with this simple task.
|
|
|
// Otherwise it would throw a ERROR_PIPE_CONNECTED Win32Exception.
|
|
|
// Otherwise it would throw a ERROR_PIPE_CONNECTED Win32Exception.
|
|
|
private static readonly ManualResetEvent manualResetEvent = new(false); |
|
|
|
|
|
|
|
|
private static readonly ManualResetEventSlim manualResetEvent = new(false); |
|
|
|
|
|
|
|
|
public static bool ShouldRedirectStdHandles; |
|
|
public static bool ShouldRedirectStdHandles; |
|
|
|
|
|
|
|
@ -58,6 +58,7 @@ namespace IPA.Logging |
|
|
{ |
|
|
{ |
|
|
Console.WriteLine(ex); |
|
|
Console.WriteLine(ex); |
|
|
pipeServer.Close(); |
|
|
pipeServer.Close(); |
|
|
|
|
|
manualResetEvent.Dispose(); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
@ -71,7 +72,7 @@ namespace IPA.Logging |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
// If the client starts first, blocks the client thread.
|
|
|
// If the client starts first, blocks the client thread.
|
|
|
manualResetEvent.WaitOne(); |
|
|
|
|
|
|
|
|
manualResetEvent.Wait(); |
|
|
pipeClient.Connect(); |
|
|
pipeClient.Connect(); |
|
|
SetStdHandle(stdHandle, pipeClient.SafePipeHandle.DangerousGetHandle()); |
|
|
SetStdHandle(stdHandle, pipeClient.SafePipeHandle.DangerousGetHandle()); |
|
|
while (pipeClient.IsConnected) |
|
|
while (pipeClient.IsConnected) |
|
@ -83,6 +84,7 @@ namespace IPA.Logging |
|
|
{ |
|
|
{ |
|
|
Console.WriteLine(ex); |
|
|
Console.WriteLine(ex); |
|
|
pipeClient.Close(); |
|
|
pipeClient.Close(); |
|
|
|
|
|
manualResetEvent.Dispose(); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|