Author: andrews
Date: 2006-07-16 12:25:25 -0400 (Sun, 16 Jul 2006)
New Revision: 62662

Modified:
   trunk/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs
   trunk/mcs/class/System/Microsoft.CSharp/ChangeLog
   trunk/mcs/class/System/System.Diagnostics/ChangeLog
   trunk/mcs/class/System/System.Diagnostics/Process.cs
Log:
* SharpCodeCompiler.cs: find mono.exe in mono/mini; fixes #78731
* Process.cs: throw FileNotFoundException earlier; give more diagnostics.


Modified: trunk/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs
===================================================================
--- trunk/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs       
2006-07-16 15:56:19 UTC (rev 62661)
+++ trunk/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs       
2006-07-16 16:25:25 UTC (rev 62662)
@@ -63,6 +63,14 @@
                                                Path.GetDirectoryName (
                                                        Path.GetDirectoryName 
(p)),
                                                "bin\\mono.exe");
+                               if (!File.Exists (windowsMonoPath))
+                                       windowsMonoPath = Path.Combine (
+                                               Path.GetDirectoryName (
+                                                       Path.GetDirectoryName (
+                                                               
Path.GetDirectoryName (p))),
+                                               "mono\\mono\\mini\\mono.exe");
+                               if (!File.Exists (windowsMonoPath))
+                                       throw new FileNotFoundException 
("Windows mono path not found: " + windowsMonoPath);
 #if NET_2_0
                                windowsMcsPath =
                                        Path.Combine (p, "2.0\\gmcs.exe");
@@ -70,6 +78,20 @@
                                windowsMcsPath =
                                        Path.Combine (p, "1.0\\mcs.exe");
 #endif
+                               if (!File.Exists (windowsMcsPath))
+#if NET_2_0
+                                       windowsMcsPath = 
+                                               Path.Combine(
+                                                       Path.GetDirectoryName 
(p),
+                                                       
"lib\\net_2_0\\gmcs.exe");
+#else
+                                       windowsMcsPath = 
+                                               Path.Combine(
+                                                       Path.GetDirectoryName 
(p),
+                                                       
"lib\\default\\mcs.exe");
+#endif
+                               if (!File.Exists (windowsMcsPath))
+                                       throw new FileNotFoundException 
("Windows mcs path not found: " + windowsMcsPath);
                        }
                }
 
@@ -148,6 +170,7 @@
                        Process mcs=new Process();
 
                        string mcs_output;
+                       string mcs_stdout;
                        string[] mcs_output_lines;
                        // FIXME: these lines had better be platform 
independent.
                        if (Path.DirectorySeparatorChar == '\\') {
@@ -170,7 +193,7 @@
                                mcs.Start();
                                // If there are a few kB in stdout, we might 
lock
                                mcs_output=mcs.StandardError.ReadToEnd();
-                               mcs.StandardOutput.ReadToEnd ();
+                               mcs_stdout=mcs.StandardOutput.ReadToEnd ();
                                mcs.WaitForExit();
                                results.NativeCompilerReturnValue = 
mcs.ExitCode;
                        } finally {
@@ -189,6 +212,10 @@
                                }
                        }
                        if (loadIt) {
+                               if (!File.Exists (options.OutputAssembly)) {
+                                       throw new Exception ("Compiler failed 
to produce the assembly. Stderr='"
+                                               +mcs_output+"', 
Stdout='"+mcs_stdout+"'");
+                               }
                                if (options.GenerateInMemory) {
                                        using (FileStream fs = 
File.OpenRead(options.OutputAssembly)) {
                                                byte[] buffer = new 
byte[fs.Length];

Modified: trunk/mcs/class/System/Microsoft.CSharp/ChangeLog
===================================================================
--- trunk/mcs/class/System/Microsoft.CSharp/ChangeLog   2006-07-16 15:56:19 UTC 
(rev 62661)
+++ trunk/mcs/class/System/Microsoft.CSharp/ChangeLog   2006-07-16 16:25:25 UTC 
(rev 62662)
@@ -1,3 +1,7 @@
+2006-07-16 Andrew Skiba <[EMAIL PROTECTED]>
+
+       * CSharpCodeCompiler.cs: find mono.exe in mono/mini; fixes #78731
+
 2006-04-30 Marek Safar <[EMAIL PROTECTED]>
 
        * CSharpCodeCompiler.cs: mcs does not like /r:"" syntax; fixes #78038.

Modified: trunk/mcs/class/System/System.Diagnostics/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.Diagnostics/ChangeLog 2006-07-16 15:56:19 UTC 
(rev 62661)
+++ trunk/mcs/class/System/System.Diagnostics/ChangeLog 2006-07-16 16:25:25 UTC 
(rev 62662)
@@ -1,3 +1,8 @@
+2006-07-16  Andrew Skiba <[EMAIL PROTECTED]>
+
+       * Process.cs: throw FileNotFoundException earlier; give more
+       diagnostics.
+
 2006-05-16  Dick Porter  <[EMAIL PROTECTED]>
 
        * Process.cs: Dispose the handle from a destructor too

Modified: trunk/mcs/class/System/System.Diagnostics/Process.cs
===================================================================
--- trunk/mcs/class/System/System.Diagnostics/Process.cs        2006-07-16 
15:56:19 UTC (rev 62661)
+++ trunk/mcs/class/System/System.Diagnostics/Process.cs        2006-07-16 
16:25:25 UTC (rev 62662)
@@ -866,6 +866,8 @@
                private static bool Start_noshell (ProcessStartInfo startInfo,
                                                   Process process)
                {
+                       if (Path.IsPathRooted (startInfo.FileName) && 
!File.Exists (startInfo.FileName))
+                               throw new FileNotFoundException  ("Executable 
not found: " + startInfo.FileName);
                        ProcInfo proc_info=new ProcInfo();
                        IntPtr stdin_rd, stdin_wr;
                        IntPtr stdout_rd, stdout_wr;
@@ -953,7 +955,11 @@
                                        MonoIO.Close (stderr_wr, out error);
                                }
 
-                               throw new Win32Exception (-proc_info.pid);
+                               throw new Win32Exception (-proc_info.pid, 
+                                       "ApplicationName='"+startInfo.FileName+
+                                       "', CommandLine='"+startInfo.Arguments+
+                                       "', 
CurrentDirectory='"+startInfo.WorkingDirectory+
+                                       "', 
PATH='"+startInfo.EnvironmentVariables["PATH"]+"'");
                        }
 
                        process.process_handle = proc_info.process_handle;

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

Reply via email to