Author: robertj
Date: 2007-10-19 14:17:33 -0400 (Fri, 19 Oct 2007)
New Revision: 87841

Modified:
   trunk/mcs/tools/mkbundle/ChangeLog
   trunk/mcs/tools/mkbundle/mkbundle.cs
Log:
2007-10-19  Robert Jordan  <[EMAIL PROTECTED]>

        * mkbundle.cs (Execute): [Windows] since recently (?) cygwin's bash
        doesn't strip CRLFs from ``-style command interpolation anymore.
        The superfluous CRLF was breaking the gcc command line.

        * mkbundle.cs (Execute): [Windows] set UseShellExecute = false to
        prevent the creation of a new console windows.



Modified: trunk/mcs/tools/mkbundle/ChangeLog
===================================================================
--- trunk/mcs/tools/mkbundle/ChangeLog  2007-10-19 18:11:12 UTC (rev 87840)
+++ trunk/mcs/tools/mkbundle/ChangeLog  2007-10-19 18:17:33 UTC (rev 87841)
@@ -1,3 +1,12 @@
+2007-10-19  Robert Jordan  <[EMAIL PROTECTED]>
+
+       * mkbundle.cs (Execute): [Windows] since recently (?) cygwin's bash
+       doesn't strip CRLFs from ``-style command interpolation anymore.
+       The superfluous CRLF was breaking the gcc command line.
+
+       * mkbundle.cs (Execute): [Windows] set UseShellExecute = false to
+       prevent the creation of a new console windows.
+
 2007-01-03  Tor Lillqvist  <[EMAIL PROTECTED]>
 
        Add the possibility to bundle also the machine.config file, from

Modified: trunk/mcs/tools/mkbundle/mkbundle.cs
===================================================================
--- trunk/mcs/tools/mkbundle/mkbundle.cs        2007-10-19 18:11:12 UTC (rev 
87840)
+++ trunk/mcs/tools/mkbundle/mkbundle.cs        2007-10-19 18:17:33 UTC (rev 
87841)
@@ -15,6 +15,7 @@
 using System.Reflection;
 using System.IO;
 using System.Runtime.InteropServices;
+using System.Text;
 using Mono.Unix;
 using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
 
@@ -569,11 +570,35 @@
 
        static int Execute (string cmdLine)
        {
-               Console.WriteLine (cmdLine);
                if (IsUnix) {
+                       Console.WriteLine (cmdLine);
                        return system (cmdLine);
-               } else {
-                       Process p = Process.Start ("sh", String.Format ("-c 
\"{0}\"", cmdLine));
+               }
+
+               // on Windows, we have to pipe the output of a
+               // `cmd` interpolation to dos2unix, because the shell does not
+               // strip the CRLFs generated by the native pkg-config 
distributed
+               // with Mono.
+               StringBuilder b = new StringBuilder ();
+               int count = 0;
+               for (int i = 0; i < cmdLine.Length; i++) {
+                       if (cmdLine [i] == '`') {
+                               if (count % 2 != 0) {
+                                       b.Append ("|dos2unix");
+                               }
+                               count++;
+                       }
+                       b.Append (cmdLine [i]);
+               }
+               cmdLine = b.ToString ();
+               Console.WriteLine (cmdLine);
+                       
+               ProcessStartInfo psi = new ProcessStartInfo ();
+               psi.UseShellExecute = false;
+               psi.FileName = "sh";
+               psi.Arguments = String.Format ("-c \"{0}\"", cmdLine);
+
+               using (Process p = Process.Start (psi)) {
                        p.WaitForExit ();
                        return p.ExitCode;
                }

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

Reply via email to