From 2f9ed92cb863c87f7bb5fa58a54c6502ef0a5e1f Mon Sep 17 00:00:00 2001 From: Jamil Djadala Date: Sat, 24 Feb 2024 23:08:57 +0200 Subject: [PATCH] suppress 'interrupted [code -10]' log message. resolve #87 (#121) --- libusb.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libusb.go b/libusb.go index 4763594..ddc0b2a 100644 --- a/libusb.go +++ b/libusb.go @@ -188,7 +188,10 @@ func (libusbImpl) handleEvents(c *libusbContext, done <-chan struct{}) { default: } if errno := C.libusb_handle_events_timeout_completed((*C.libusb_context)(c), &tv, nil); errno < 0 { - log.Printf("handle_events: error: %s", Error(errno)) + // handler can be interrupted by a signal and this doesn't indicate an error, we'll retry on the next loop iteration + if Error(errno) != ErrorInterrupted { + log.Printf("handle_events: error: %s", Error(errno)) + } } } }