+2007-10-19 Robert Jordan <robertj@gmx.net>
+
+ * 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 <tml@novell.com>
Add the possibility to bundle also the machine.config file, from
using System.Reflection;
using System.IO;
using System.Runtime.InteropServices;
+using System.Text;
using Mono.Unix;
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
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;
}