From d72ec73e03c5712cc941b74bee5f55872a6a081a Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Tue, 5 Dec 2017 14:35:24 +0000 Subject: [PATCH] [Xamarin.ProjectTools] Only add the process.log if it exists. This commit adds an additional check to only process the process.log if the file exists. We might be in a situation where nothing is written to StdOut or StdErr as a result we might not get a log file. So lets not crash the test if it does not exist. --- .../Tests/Xamarin.ProjectTools/Common/Builder.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/Builder.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/Builder.cs index c19ce880c67..397c70fe3e8 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/Builder.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/Builder.cs @@ -360,7 +360,8 @@ protected bool BuildInternal (string projectOrSolution, string target, string [] if (buildLogFullPath != null && processLog != null) { Directory.CreateDirectory (Path.GetDirectoryName (buildLogFullPath)); - File.AppendAllText (buildLogFullPath, File.ReadAllText (processLog)); + if (File.Exists (processLog)) + File.AppendAllText (buildLogFullPath, File.ReadAllText (processLog)); } if (!result && ThrowOnBuildFailure) { string message = "Build failure: " + Path.GetFileName (projectOrSolution) + (BuildLogFile != null && File.Exists (buildLogFullPath) ? "Build log recorded at " + buildLogFullPath : null);