Report the actual error instead of nil
This commit is contained in:
@@ -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)}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user