diff --git a/src/Particular.PlatformSample/AppLauncher.cs b/src/Particular.PlatformSample/AppLauncher.cs index 692907e..8f37657 100644 --- a/src/Particular.PlatformSample/AppLauncher.cs +++ b/src/Particular.PlatformSample/AppLauncher.cs @@ -16,9 +16,13 @@ sealed class AppLauncher(bool showPlatformToolConsoleOutput) : IAsyncDisposable readonly bool hideConsoleOutput = !showPlatformToolConsoleOutput; readonly Stack> cleanupActions = new(); readonly List platformTools = []; + volatile bool captureErrorOutput = true; public sealed record PlatformTool(string Name, Process Process, StringBuilder ErrorOutput); + // The error output is only needed to report a startup failure, so stop keeping it once startup succeeds + public void StopCapturingErrorOutput() => captureErrorOutput = false; + public void StopProcesses() { foreach (var tool in platformTools) @@ -220,10 +224,11 @@ void StartProcess(string name, string assemblyPath, Dictionary e // without this in certain occasions the start takes waaaaay longer! if (hideConsoleOutput) { - // Keep the hidden error output so it can be shown if the tool fails to start + // Keep the hidden error output so it can be shown if the tool fails to start. + // The stream is still read after capturing stops, otherwise the tool blocks once the pipe buffer is full. process.ErrorDataReceived += (_, args) => { - if (args.Data is not null) + if (args.Data is not null && captureErrorOutput) { tool.ErrorOutput.AppendLine(args.Data); } diff --git a/src/Particular.PlatformSample/PlatformLauncher.cs b/src/Particular.PlatformSample/PlatformLauncher.cs index a977b10..d3552bb 100644 --- a/src/Particular.PlatformSample/PlatformLauncher.cs +++ b/src/Particular.PlatformSample/PlatformLauncher.cs @@ -131,6 +131,8 @@ await Network.WaitForHttpOk($"http://localhost:{controlPort}/api", stopWaiting: return; } + launcher.StopCapturingErrorOutput(); + if (!tokenSource.IsCancellationRequested) { var serviceControlApiUrl = $"http://localhost:{controlPort}/api";