Remove Environment.Exit from Daemon
MODIFY
WalletWasabi.Gui/CommandLine/MixerCommand.cs
WalletWasabi.Gui/CommandLine/MixerCommand.cs
@@ -25,40 +25,28 @@ namespace WalletWasabi.Gui.CommandLine
};
}
- public string WalletName { get; set; }
- public string DestinationWalletName { get; set; }
+ public string? WalletName { get; set; }
+ public string? DestinationWalletName { get; set; }
public bool KeepMixAlive { get; set; }
public bool ShowHelp { get; set; }
public Daemon Daemon { get; }
public override async Task<int> InvokeAsync(IEnumerable<string> args)
{
- var error = false;
- try
- {
- var extra = Options.Parse(args);
+ Options.Parse(args);
if (ShowHelp)
{
Options.WriteOptionDescriptions(CommandSet.Out);
}
-
- if (!error && !ShowHelp)
- {
- await Daemon.RunAsync(WalletName, DestinationWalletName ?? WalletName, KeepMixAlive);
- }
- }
- catch (Exception ex)
+ else
{
- if (!(ex is OperationCanceledException))
+ if (WalletName is null)
{
- Logger.LogCritical(ex);
+ throw new ArgumentNullException($"Argument {nameof(WalletName)} must be set.");
}
- Console.WriteLine($"commands: There was a problem interpreting the command, please review it.");
- Logger.LogDebug(ex);
- error = true;
+ await Daemon.RunAsync(WalletName, DestinationWalletName ?? WalletName, KeepMixAlive).ConfigureAwait(false);
}
- Environment.Exit(error ? 1 : 0);
return 0;
}
}

MODIFY
WalletWasabi.Gui/Program.cs
WalletWasabi.Gui/Program.cs
@@ -58,6 +58,10 @@ namespace WalletWasabi.Gui
BuildAvaloniaApp().StartShellApp("Wasabi Wallet", AppMainAsync, args);
}
}
+ catch (OperationCanceledException ex)
+ {
+ Logger.LogDebug(ex);
+ }
catch (Exception ex)
{
Logger.LogCritical(ex);

Remove Environment.Exit from Daemon