1
0
mirror of https://github.com/shirou/gopsutil.git synced 2025-04-24 13:48:56 +08:00

Merge pull request #1699 from shirou/feat/win_disk_ignore_remote_drive_on_error

[disk][windows]: ignore network drive when not ready
This commit is contained in:
shirou 2024-08-26 23:52:13 +09:00 committed by GitHub
commit 7404c1f39d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -133,7 +133,7 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
uintptr(unsafe.Pointer(&lpFileSystemNameBuffer[0])),
uintptr(len(lpFileSystemNameBuffer)))
if driveret == 0 {
if typeret == 5 || typeret == 2 {
if typeret == 2 || typeret == 4 || typeret == 5 {
continue // device is not ready will happen if there is no disk in the drive
}
warnings.Add(err)