This commit is contained in:
Khaleel Al-Adhami 2025-02-22 10:21:26 -08:00 committed by GitHub
commit e6d2175779
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1936,13 +1936,13 @@ def get_cpu_info() -> CpuInfo | None:
cpuinfo = {} cpuinfo = {}
try: try:
if platform_os == "Windows": if platform_os == "Windows":
cmd = "wmic cpu get addresswidth,caption,manufacturer /FORMAT:csv" cmd = 'powershell -Command "Get-CimInstance Win32_Processor | Select-Object AddressWidth,Manufacturer,Name | ConvertTo-Json"'
output = processes.execute_command_and_return_output(cmd) output = processes.execute_command_and_return_output(cmd)
if output: if output:
val = output.splitlines()[-1].split(",")[1:] cpu_data = json.loads(output)
cpuinfo["manufacturer_id"] = val[2] cpuinfo["address_width"] = cpu_data["AddressWidth"]
cpuinfo["model_name"] = val[1].split("Family")[0].strip() cpuinfo["manufacturer_id"] = cpu_data["Manufacturer"]
cpuinfo["address_width"] = format_address_width(val[0]) cpuinfo["model_name"] = cpu_data["Name"]
elif platform_os == "Linux": elif platform_os == "Linux":
output = processes.execute_command_and_return_output("lscpu") output = processes.execute_command_and_return_output("lscpu")
if output: if output: