From be06c89627c4d032964205f648dc0d698d343c3d Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Tue, 5 Apr 2022 21:15:48 +0200 Subject: [PATCH] fix(spotify): ignore errors resolves #2031 --- src/environment/windows_win32.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/environment/windows_win32.go b/src/environment/windows_win32.go index 5ded0761..e69e53b2 100644 --- a/src/environment/windows_win32.go +++ b/src/environment/windows_win32.go @@ -57,21 +57,14 @@ func getWindowText(hwnd syscall.Handle, str *uint16, maxCount int32) (length int func getWindowFileName(handle syscall.Handle) (string, error) { var pid int - // get pid - _, _, err := procGetWindowThreadProcessID.Call(uintptr(handle), uintptr(unsafe.Pointer(&pid))) - if err != nil && err.Error() != "The operation completed successfully." { - return "", errors.New("unable to get window process pid") - } + _, _, _ = procGetWindowThreadProcessID.Call(uintptr(handle), uintptr(unsafe.Pointer(&pid))) const query = windows.PROCESS_QUERY_INFORMATION | windows.PROCESS_VM_READ h, err := windows.OpenProcess(query, false, uint32(pid)) if err != nil { return "", errors.New("unable to open window process") } buf := [1024]byte{} - length, _, err := getModuleBaseNameA.Call(uintptr(h), 0, uintptr(unsafe.Pointer(&buf)), 1024) - if err != nil && err.Error() != "The operation completed successfully." { - return "", errors.New("unable to get window process name") - } + length, _, _ := getModuleBaseNameA.Call(uintptr(h), 0, uintptr(unsafe.Pointer(&buf)), 1024) filename := string(buf[:length]) return strings.ToLower(filename), nil }