[xbuild] Handle multi-line output from tool.
authorAnkit Jain <radical@corewars.org>
Thu, 5 Aug 2010 12:02:19 +0000 (17:32 +0530)
committerAnkit Jain <radical@corewars.org>
Thu, 5 Aug 2010 12:05:05 +0000 (17:35 +0530)
Output received from the process can be multiline, split and process
it.

mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/ToolTask.cs

index de05e9c71fddcfde086c376ce694ea4a03e7dcb8..74e1b7610de0e8a4ffbb52542fd8515e508bdad4 100644 (file)
@@ -194,12 +194,14 @@ namespace Microsoft.Build.Utilities
 
                void ProcessLine (string line, MessageImportance importance)
                {
-                       toolOutput.AppendLine (line);
+                       foreach (string singleLine in line.Split (new string [] {Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries)) {
+                               toolOutput.AppendLine (singleLine);
 
-                       // in case of typeLoadException, collect all the output
-                       // and then handle in ProcessTypeLoadException
-                       if (!typeLoadException)
-                               LogEventsFromTextOutput (line, importance);
+                               // in case of typeLoadException, collect all the output
+                               // and then handle in ProcessTypeLoadException
+                               if (!typeLoadException)
+                                       LogEventsFromTextOutput (singleLine, importance);
+                       }
                }
 
                protected virtual void LogEventsFromTextOutput (string singleLine, MessageImportance importance)