Do not fail on virtualized windows systems (#1669)

this handles virtualized systems without Win32_ComputerSystemProduct entries by returning 'unknown' for system product name

Co-authored-by: Bjoern Brauer <zaubernerd@zaubernerd.de>
This commit is contained in:
Deniz Adrian 2024-03-06 14:32:34 +01:00 committed by GitHub
parent 199bf73103
commit 6d747b2f83
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -165,6 +165,10 @@ func sysProductName() (string, error) {
if err != nil {
return "", err
}
// `ComputerSystemProduct` could be empty on some virtualized systems
if len(dst) < 1 {
return "unknown", nil
}
return dst[0].Name, nil
}