hactoolnet: Set a different exit code on error

This commit is contained in:
Alex Barney 2019-03-08 12:41:55 -06:00
parent 7904772fc0
commit f85eff4ab7

View file

@ -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)