mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-11-04 02:25:28 +08:00 
			
		
		
		
	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:
		
				
					committed by
					
						
						Patrik Svensson
					
				
			
			
				
	
			
			
			
						parent
						
							fd217ffc83
						
					
				
				
					commit
					28e9c14de4
				
			@@ -27,5 +27,15 @@ namespace Injection
 | 
			
		||||
        {
 | 
			
		||||
            _builder.AddSingleton(service, implementation);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void RegisterLazy(Type service, Func<object> func)
 | 
			
		||||
        {
 | 
			
		||||
            if (func is null)
 | 
			
		||||
            {
 | 
			
		||||
                throw new ArgumentNullException(nameof(func));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            _builder.AddSingleton(service, (provider) => func());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user