Skip to content

Commit

Permalink
fix: get the error sn when there is some warning like redheat os (#1038)
Browse files Browse the repository at this point in the history
get the error sn when there is some warning like redheat os
  • Loading branch information
wudihechao authored Aug 22, 2024
1 parent 5402d79 commit c7f919f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,16 @@ func GetBiosSn() (string, error) {
if err != nil {
return "", fmt.Errorf("failed to get bios sn: %v", err)
}
sn = strings.TrimSpace(string(out))
lines := strings.Split(string(out), "\n")
for _, line := range lines {
if strings.HasPrefix(line, "#") {
continue
}
if len(line) > 0 {
sn = strings.TrimSpace(line)
break
}
}
default:
return "", fmt.Errorf("not support os to get sn")
}
Expand Down

0 comments on commit c7f919f

Please sign in to comment.