Fix threading issue in source build smoke tests (#15009)

This commit is contained in:
Michael Simons 2022-11-17 16:43:16 -06:00 committed by GitHub
parent 03c15d0900
commit b504dab642
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -75,16 +75,30 @@ internal static class ExecuteHelper
process.WaitForExit();
}
string output = stdOutput.ToString().Trim();
if (logOutput && !string.IsNullOrWhiteSpace(output))
string output;
string error;
lock (stdOutput)
{
outputHelper.WriteLine(output);
output = stdOutput.ToString().Trim();
}
string error = stdError.ToString().Trim();
if (logOutput && !string.IsNullOrWhiteSpace(error))
lock (stdError)
{
outputHelper.WriteLine(error);
error = stdError.ToString().Trim();
}
if (logOutput)
{
if (!string.IsNullOrWhiteSpace(output))
{
outputHelper.WriteLine(output);
}
if (string.IsNullOrWhiteSpace(error))
{
outputHelper.WriteLine(error);
}
}
return (process, output, error);