Switch to event driven reading from standard output and error
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user