Register the console lazily in CLI type registrar

This should fix a strange bug we're seeing in Cake on macOS.
This commit is contained in:
Patrik Svensson
2021-02-12 00:02:59 +01:00
committed by Patrik Svensson
parent fd217ffc83
commit 28e9c14de4
5 changed files with 47 additions and 1 deletions

View File

@@ -24,7 +24,7 @@ namespace Spectre.Console.Cli
}
_registrar.RegisterInstance(typeof(IConfiguration), configuration);
_registrar.RegisterInstance(typeof(IAnsiConsole), configuration.Settings.Console.GetConsole());
_registrar.RegisterLazy(typeof(IAnsiConsole), () => configuration.Settings.Console.GetConsole());
// Create the command model.
var model = CommandModelBuilder.Build(configuration);