From f3df6fbded3ab028b75151ea03cc89a10e0c9a01 Mon Sep 17 00:00:00 2001 From: ASAKURA Kazuki <32762324+Arthur1@users.noreply.github.com> Date: Thu, 11 Apr 2024 13:57:20 +0900 Subject: [PATCH] ignore error of getting information of a disk on Windows --- util/windows/filesystem.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/util/windows/filesystem.go b/util/windows/filesystem.go index c6bde87e7..815f58cc5 100644 --- a/util/windows/filesystem.go +++ b/util/windows/filesystem.go @@ -66,8 +66,8 @@ func CollectFilesystemValues() (map[string]FilesystemInfo, error) { uintptr(unsafe.Pointer(&drivebuf[0])), uintptr(len(drivebuf))) if r == 0 { - windowsLogger.Debugf("do not get DosDevice [%q]", drivebuf) - return nil, err + windowsLogger.Warningf("do not get DosDevice [%q]: %v", drivebuf, err) + continue } volumebuf := make([]uint16, 256) fsnamebuf := make([]uint16, 256) @@ -86,8 +86,8 @@ func CollectFilesystemValues() (map[string]FilesystemInfo, error) { uintptr(unsafe.Pointer(&fsnamebuf[0])), uintptr(len(fsnamebuf))) if r == 0 { - windowsLogger.Debugf("do not get volume [%q] or fsname [%q]", volumebuf, fsnamebuf) - return nil, err + windowsLogger.Warningf("do not get volume [%q] or fsname [%q]: %v", volumebuf, fsnamebuf, err) + continue } freeBytesAvailable := int64(0) totalNumberOfBytes := int64(0) @@ -95,12 +95,13 @@ func CollectFilesystemValues() (map[string]FilesystemInfo, error) { if err != nil { return nil, err } - r, _, _ = GetDiskFreeSpaceEx.Call( + r, _, err = GetDiskFreeSpaceEx.Call( uintptr(unsafe.Pointer(d)), uintptr(unsafe.Pointer(&freeBytesAvailable)), uintptr(unsafe.Pointer(&totalNumberOfBytes)), 0) if r == 0 { + windowsLogger.Warningf("do not get disk free space [%q]: %v", volumebuf, fsnamebuf, err) continue } filesystems[drive] = FilesystemInfo{