Skip to content

Commit

Permalink
Make sure exitcode is set
Browse files Browse the repository at this point in the history
  • Loading branch information
asdacap committed Jun 28, 2022
1 parent 919f908 commit 06c26a6
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/Nethermind/Nethermind.Runner/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ private static void Run(string[] args)

app.OnExecute(async () =>
{
_appClosed.Reset();
IConfigProvider configProvider = BuildConfigProvider(app, loggerConfigSource, logLevelOverride, configsDirectory, configFile);
IInitConfig initConfig = configProvider.GetConfig<IInitConfig>();
IKeyStoreConfig keyStoreConfig = configProvider.GetConfig<IKeyStoreConfig>();
Expand Down Expand Up @@ -175,6 +174,7 @@ private static void Run(string[] args)
INethermindApi nethermindApi = apiBuilder.Create(plugins.OfType<IConsensusPlugin>());
((List<INethermindPlugin>)nethermindApi.Plugins).AddRange(plugins);
_appClosed.Reset();
EthereumRunner ethereumRunner = new(nethermindApi);
bool runFailed = false;
try
Expand Down Expand Up @@ -202,8 +202,19 @@ private static void Run(string[] args)
return 0;
});

_ = app.Execute(args);
_appClosed.Wait();
try
{
Environment.ExitCode = app.Execute(args);
}
catch (Exception)
{
Environment.ExitCode = -1;
throw;
}
finally
{
_appClosed.Wait();
}
}

private static void BuildOptionsFromConfigFiles(CommandLineApplication app)
Expand Down

0 comments on commit 06c26a6

Please sign in to comment.