From b7483e31a79c068ccdafa1bd5a39ec284e74c968 Mon Sep 17 00:00:00 2001 From: Dirk007 Date: Sat, 7 Sep 2024 13:26:01 +0200 Subject: [PATCH] Report the actual error instead of nil --- serial_unix.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serial_unix.go b/serial_unix.go index 54e55a8..e6913c2 100644 --- a/serial_unix.go +++ b/serial_unix.go @@ -241,7 +241,7 @@ func nativeOpen(portName string, mode *Mode) (*unixPort, error) { // Explicitly disable RTS/CTS flow control setTermSettingsCtsRts(false, settings) - if port.setTermSettings(settings) != nil { + if err = port.setTermSettings(settings); err != nil { port.Close() return nil, &PortError{code: InvalidSerialPort, causedBy: fmt.Errorf("error setting term settings: %w", err)} }