Skip to content

Commit

Permalink
Fix Cocona.Lite
Browse files Browse the repository at this point in the history
  • Loading branch information
mayuki committed Mar 5, 2024
1 parent f6e8e49 commit 523812e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Cocona.Lite/Lite/Hosting/CoconaLiteAppHost.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System;
using Cocona.Application;
using Cocona.Command;

namespace Cocona.Lite.Hosting;
Expand All @@ -21,6 +23,7 @@ public async Task RunAsync(CancellationToken cancellationToken)
{
var linkedCancellationToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, _cancellationTokenSource.Token);
var bootstrapper = _serviceProvider.GetRequiredService<ICoconaBootstrapper>();
var console = _serviceProvider.GetRequiredService<ICoconaConsoleProvider>();

#pragma warning disable RS0030 // Do not used banned APIs
Console.CancelKeyPress += OnCancelKeyPress;
Expand Down Expand Up @@ -54,6 +57,13 @@ public async Task RunAsync(CancellationToken cancellationToken)
// NOTE: Ignore OperationCanceledException that was thrown by non-user code.
Environment.ExitCode = 130;
}
catch (Exception ex)
{
console.Error.WriteLine(ex.ToString());
Environment.ExitCode = 1;
// NOTE: Exception is suppressed here to match the behavior of Cocona.
//throw;
}

_waitForShutdown.Set();

Expand Down

0 comments on commit 523812e

Please sign in to comment.