Skip to content

Commit

Permalink
Try to capture process output in different way
Browse files Browse the repository at this point in the history
  • Loading branch information
vplauzon committed Dec 17, 2021
1 parent 130fd9b commit 700ef10
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions code/DeltaKustoFileIntegrationTest/IntegrationTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ protected IntegrationTestBase()
}

protected SimpleHttpClientFactory HttpClientFactory { get; }

protected ITracer Tracer { get; }

protected async virtual Task<int> RunMainAsync(params string[] args)
Expand All @@ -137,10 +137,6 @@ protected async virtual Task<int> RunMainAsync(params string[] args)
{
process.StartInfo.ArgumentList.Add(arg);
}
process.OutputDataReceived +=
(sender, data) => Console.WriteLine(data.Data);
process.ErrorDataReceived +=
(sender, data) => Console.WriteLine(data.Data);

var started = process.Start();

Expand All @@ -150,6 +146,20 @@ protected async virtual Task<int> RunMainAsync(params string[] args)

await process.WaitForExitAsync(ct);

var output = await process.StandardOutput.ReadToEndAsync();
var errors = await process.StandardError.ReadToEndAsync();

if (output.Length != 0)
{
Console.WriteLine("Output: ");
Console.WriteLine(output);
}
if (errors.Length != 0)
{
Console.WriteLine("Errors: ");
Console.WriteLine(errors);
}

return process.ExitCode;
}
else
Expand Down

0 comments on commit 700ef10

Please sign in to comment.