From d9d6aecdcbe51bc2f8597cdfa865728cabff09a0 Mon Sep 17 00:00:00 2001 From: Zeid Derhally Date: Fri, 15 Feb 2019 14:08:31 -0500 Subject: [PATCH] Switch to event driven reading from standard output and error --- src/coverlet.console/Program.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/coverlet.console/Program.cs b/src/coverlet.console/Program.cs index 2f93bef..87e656e 100644 --- a/src/coverlet.console/Program.cs +++ b/src/coverlet.console/Program.cs @@ -61,10 +61,8 @@ namespace Coverlet.Console process.StartInfo.RedirectStandardError = true; process.Start(); - process.StandardOutput.ReadToEndAsync() - .ContinueWith(task => logger.LogInformation(task.Result), TaskContinuationOptions.OnlyOnRanToCompletion); - process.StandardError.ReadToEndAsync() - .ContinueWith(task => logger.LogError(task.Result), TaskContinuationOptions.OnlyOnRanToCompletion); + process.OutputDataReceived += (sender, eventArgs) => logger.LogInformation(eventArgs.Data); + process.ErrorDataReceived += (sender, eventArgs) => logger.LogError(eventArgs.Data); process.WaitForExit();