[Mono-bugs] [Bug 76403][Wis] Changed - When starting another Console App, a new "console" isn't open but rather the outputs get mixed

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Oct 11 10:54:41 EDT 2005

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by kornelpal at hotmail.com.


--- shadow/76403	2005-10-11 10:16:41.000000000 -0400
+++ shadow/76403.tmp.26309	2005-10-11 10:54:40.000000000 -0400
@@ -21,6 +21,53 @@
 making it all very confusing. On Windows the MS.NET code opens up a whole
 new DOS window while mono on Windows and Linux just mixes both consoles.
 ------- Additional Comments From vargaz at gmail.com  2005-10-11 10:16 -------
 What should the mono behaviour be in this case ?
+------- Additional Comments From kornelpal at hotmail.com  2005-10-11 10:54 -------
+Some tests:
+ProcessStartInfo psi;
+Console.WriteLine("This is .NET app (1)");
+psi = new ProcessStartInfo("cmd.exe");
+psi = new ProcessStartInfo("cmd.exe");
+psi.UseShellExecute = false;
+Console.WriteLine("This is .NET app (2)");
+Note that I used WaitForExit as without WaitForExit console is 
+shared between the managed app and cmd.exe. This is the same on Mono 
+and MS.NET so this is the expected behaviour.
+The difference is that when UseShellExecute = true (default) is used 
+a new console window will be created.
+The difference is in the implementation of Process.Start in MS.NET 
+and Mono.
+MS.NET uses CreateProcess when UseShellExecute = false and 
+ShellExecuteEx when UseShellExecute = true.
+ProcessStartInfo properties ErrorDialog, ErrorDialogParentHandle, 
+Verb, Verbs are only used with ShellExecuteEx.
+While Mono uses cmd.exe to execute the command this results in a 
+quite different behaviour. I think on Windows Mono should use 
+ShellExecuteEx just like MS.NET.
+On Linux using shell executable may be a good solution but I don't 
+know the features of Linux enought to can suggest another solution 
+that is more like to ShellExecuteEx.
+ShellExecuteEx executes the associated executable and instructs it 
+to open the file specified int FileName. CreateProcess executes 
+FileName if it were an executable. On Windows this means that it is 
+treated as a .com file if it has no .bat or .cmd extension and has 
+no MZ header. If there is Linux has some functionality that is more 
+like this behavour it should be used instead of executing shell as 
+shell interprets some other things on command line like redirection 
+like | or > that should not be allowed.

More information about the mono-bugs mailing list