From cc8b19c1a1fe2c67af5b8a68f96dd4a9f23e0203 Mon Sep 17 00:00:00 2001 From: Marek Safar Date: Wed, 16 Feb 2011 14:47:23 +0000 Subject: [PATCH 1/1] Fix mcs exit code for informative arguments --- mcs/mcs/driver.cs | 3 +++ mcs/mcs/rootcontext.cs | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/mcs/mcs/driver.cs b/mcs/mcs/driver.cs index 903e9dd0217..1b776da4232 100644 --- a/mcs/mcs/driver.cs +++ b/mcs/mcs/driver.cs @@ -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) { diff --git a/mcs/mcs/rootcontext.cs b/mcs/mcs/rootcontext.cs index 83da55288ca..3d2b5109196 100644 --- a/mcs/mcs/rootcontext.cs +++ b/mcs/mcs/rootcontext.cs @@ -185,6 +185,7 @@ namespace Mono.CSharp { readonly Report report; readonly TextWriter output; + bool stop_argument; public event Func 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 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; } } -- 2.25.1