| 
									
										
										
										
											2024-09-21 12:24:21 -07:00
										 |  |  | # typed: strict | 
					
						
							| 
									
										
										
										
											2022-11-21 21:04:22 -08:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-09-21 12:24:21 -07:00
										 |  |  | module OS | 
					
						
							|  |  |  |   module Linux | 
					
						
							|  |  |  |     module SimulateSystem | 
					
						
							| 
									
										
										
										
											2022-11-21 21:04:22 -08:00
										 |  |  |       sig { returns(T.nilable(Symbol)) } | 
					
						
							|  |  |  |       def os | 
					
						
							| 
									
										
										
										
											2024-09-21 12:24:21 -07:00
										 |  |  |         @os ||= T.let(nil, T.nilable(Symbol)) | 
					
						
							| 
									
										
										
										
											2022-11-21 21:04:22 -08:00
										 |  |  |         return :macos if @os.blank? && Homebrew::EnvConfig.simulate_macos_on_linux? | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         @os | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       sig { returns(T::Boolean) } | 
					
						
							|  |  |  |       def simulating_or_running_on_linux? | 
					
						
							|  |  |  |         os.blank? || os == :linux | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       sig { returns(Symbol) } | 
					
						
							|  |  |  |       def current_os | 
					
						
							|  |  |  |         os || :linux | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end | 
					
						
							| 
									
										
										
										
											2024-09-21 12:24:21 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | Homebrew::SimulateSystem.singleton_class.prepend(OS::Linux::SimulateSystem) |