From f85eff4ab7b99a352078375a905eec4a2c35c457 Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Fri, 8 Mar 2019 12:41:55 -0600 Subject: [PATCH] hactoolnet: Set a different exit code on error --- src/hactoolnet/Program.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/hactoolnet/Program.cs b/src/hactoolnet/Program.cs index 285231a1..b3049637 100644 --- a/src/hactoolnet/Program.cs +++ b/src/hactoolnet/Program.cs @@ -7,11 +7,11 @@ namespace hactoolnet { public static class Program { - public static void Main(string[] args) + public static int Main(string[] args) { try { - Run(args); + if (Run(args)) return 0; } catch (MissingKeyException ex) { @@ -26,14 +26,16 @@ namespace hactoolnet Console.WriteLine(ex.GetType().FullName); Console.WriteLine(ex.StackTrace); } + + return 1; } - private static void Run(string[] args) + private static bool Run(string[] args) { Console.OutputEncoding = Encoding.UTF8; var ctx = new Context(); ctx.Options = CliParser.Parse(args); - if (ctx.Options == null) return; + if (ctx.Options == null) return false; using (var logger = new ProgressBar()) { @@ -43,11 +45,13 @@ namespace hactoolnet if (ctx.Options.RunCustom) { CustomTask(ctx); - return; + return true; } RunTask(ctx); } + + return true; } private static void RunTask(Context ctx)