Author: mhutch
Date: 2008-01-03 13:41:29 -0500 (Thu, 03 Jan 2008)
New Revision: 92199

Modified:
   
trunk/monodevelop/main/src/addins/CSharpBinding/CSharpBindingCompilerManager.cs
   trunk/monodevelop/main/src/addins/CSharpBinding/ChangeLog
Log:
* CSharpBindingCompilerManager.cs: Check C# compiler exit code to
  detect when it crashes. Should fix "Bug 351347 - MD ignores
  mcs/gmcs crash".

Modified: 
trunk/monodevelop/main/src/addins/CSharpBinding/CSharpBindingCompilerManager.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/CSharpBinding/CSharpBindingCompilerManager.cs 
    2008-01-03 17:56:08 UTC (rev 92198)
+++ 
trunk/monodevelop/main/src/addins/CSharpBinding/CSharpBindingCompilerManager.cs 
    2008-01-03 18:41:29 UTC (rev 92199)
@@ -232,12 +232,16 @@
 
                        LoggingService.LogInfo (compilerName + " " + 
writer.ToString ());
                        
-                       DoCompilation(outstr, tf, workingDir, gacRoots, ref 
output, ref error);
-
+                       int exitCode = DoCompilation (outstr, tf, workingDir, 
gacRoots, ref output, ref error);
+                       
                        ICompilerResult result = ParseOutput(tf, output, error);
                        if (result.CompilerOutput.Trim () != "")
                                monitor.Log.WriteLine (result.CompilerOutput);
-
+                       
+                       //if compiler crashes, output entire error string
+                       if (result.ErrorCount == 0 && exitCode != 0)
+                               result.AddError (error);
+                       
                        FileService.DeleteFile (responseFileName);
                        FileService.DeleteFile (output);
                        FileService.DeleteFile (error);
@@ -329,7 +333,7 @@
                        return new DefaultCompilerResult(cr, 
compilerOutput.ToString());
                }
                
-               private void DoCompilation(string outstr, TempFileCollection 
tf, string working_dir, ArrayList gacRoots, ref string output, ref string 
error) {
+               private int DoCompilation (string outstr, TempFileCollection 
tf, string working_dir, ArrayList gacRoots, ref string output, ref string 
error) {
                        output = Path.GetTempFileName();
                        error = Path.GetTempFileName();
                        
@@ -356,8 +360,11 @@
                        
                        ProcessWrapper pw = Runtime.ProcessService.StartProcess 
(pinfo, outwr, errwr, null);
                        pw.WaitForOutput();
+                       int exitCode = pw.ExitCode;
                        outwr.Close();
                        errwr.Close();
+                       pw.Dispose ();
+                       return exitCode;
                }
 
 

Modified: trunk/monodevelop/main/src/addins/CSharpBinding/ChangeLog
===================================================================
--- trunk/monodevelop/main/src/addins/CSharpBinding/ChangeLog   2008-01-03 
17:56:08 UTC (rev 92198)
+++ trunk/monodevelop/main/src/addins/CSharpBinding/ChangeLog   2008-01-03 
18:41:29 UTC (rev 92199)
@@ -1,3 +1,8 @@
+2008-01-03  Michael Hutchinson <[EMAIL PROTECTED]> 
+
+       * CSharpBindingCompilerManager.cs: Check C# compiler exit code to detect
+         when it crashes. Should fix "Bug 351347 - MD ignores mcs/gmcs crash".
+
 2007-12-31  Michael Hutchinson <[EMAIL PROTECTED]> 
 
        * templates/AssemblyInfo.xft.xml: Add revision to version number.

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to