Fix mcs exit code for informative arguments
authorMarek Safar <marek.safar@gmail.com>
Wed, 16 Feb 2011 14:47:23 +0000 (14:47 +0000)
committerMarek Safar <marek.safar@gmail.com>
Wed, 16 Feb 2011 14:48:00 +0000 (14:48 +0000)
mcs/mcs/driver.cs
mcs/mcs/rootcontext.cs

index 903e9dd02179f6603f7dad740716f91b23d63c46..1b776da423296db0595eae527ef432b1baaa481b 100644 (file)
@@ -124,6 +124,9 @@ namespace Mono.CSharp
                        if (settings == null || r.Errors > 0)
                                return 1;
 
+                       if (cmd.HasBeenStopped)
+                               return 0;
+
                        Driver d = new Driver (new CompilerContext (settings, r));
 
                        if (d.Compile () && d.Report.Errors == 0) {
index 83da55288ca7b4c7105c99817891f4e6291aa9ae..3d2b51091965dbf2e6c7e2cd66bb419083a67b60 100644 (file)
@@ -185,6 +185,7 @@ namespace Mono.CSharp {
 
                readonly Report report;
                readonly TextWriter output;
+               bool stop_argument;
 
                public event Func<string[], int, int> UnknownOptionHandler;
 
@@ -199,6 +200,12 @@ namespace Mono.CSharp {
                        this.output = messagesOutput;
                }
 
+               public bool HasBeenStopped {
+                       get {
+                               return stop_argument;
+                       }
+               }
+
                void About ()
                {
                        output.WriteLine (
@@ -217,6 +224,7 @@ namespace Mono.CSharp {
                        CompilerSettings settings = new CompilerSettings ();
                        List<string> response_file_list = null;
                        bool parsing_options = true;
+                       stop_argument = false;
 
                        for (int i = 0; i < args.Length; i++) {
                                string arg = args[i];
@@ -261,7 +269,8 @@ namespace Mono.CSharp {
                                                case ParseResult.Success:
                                                        continue;
                                                case ParseResult.Stop:
-                                                       return null;
+                                                       stop_argument = true;
+                                                       return settings;
                                                }
                                        }
 
@@ -285,7 +294,8 @@ namespace Mono.CSharp {
                                                        return null;
 
                                                case ParseResult.Stop:
-                                                       return null;
+                                                       stop_argument = true;
+                                                       return settings;
                                                }
                                        }