Skip to content

Commit

Permalink
ignore NODEV errors when parsing powersupply files
Browse files Browse the repository at this point in the history
Signed-off-by: Marvin Sinister <marvin.sinister@gmail.com>
  • Loading branch information
marvin-sinister authored and discordianfish committed May 27, 2024
1 parent 513f259 commit d9448e6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sysfs/class_power_supply.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func parsePowerSupply(path string) (*PowerSupply, error) {
name := filepath.Join(path, f.Name())
value, err := util.SysReadFile(name)
if err != nil {
if os.IsNotExist(err) || err.Error() == "operation not supported" || errors.Is(err, os.ErrInvalid) {
if os.IsNotExist(err) || err.Error() == "operation not supported" || err.Error() == "no such device" || errors.Is(err, os.ErrInvalid) {
continue
}
return nil, fmt.Errorf("failed to read file %q: %w", name, err)
Expand Down

0 comments on commit d9448e6

Please sign in to comment.