From 5178efb17b80562c60b540dbb4f38123f33d5fd3 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Fri, 8 Sep 2017 19:23:48 +0100 Subject: [PATCH] Fix thread safety issue that was causing intermittent build failures --- test/Templates.Test/Helpers/ProcessEx.cs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/test/Templates.Test/Helpers/ProcessEx.cs b/test/Templates.Test/Helpers/ProcessEx.cs index 91bf36b3a8..f2204835c8 100644 --- a/test/Templates.Test/Helpers/ProcessEx.cs +++ b/test/Templates.Test/Helpers/ProcessEx.cs @@ -56,9 +56,27 @@ namespace Templates.Test.Helpers proc.BeginErrorReadLine(); } - public string Error => _stderrCapture.ToString(); + public string Error + { + get + { + lock (_pipeCaptureLock) + { + return _stderrCapture.ToString(); + } + } + } - public string Output => _stdoutCapture.ToString(); + public string Output + { + get + { + lock (_pipeCaptureLock) + { + return _stdoutCapture.ToString(); + } + } + } public int ExitCode => _process.ExitCode;