Skip enumerating ports that are not accessible for any reason
Otherwise ports like /dev/ttyS0 may be listed in case of "access denied" errors.
This commit is contained in:
@@ -286,10 +286,7 @@ func nativeGetPortsList() ([]string, error) {
|
||||
if strings.HasPrefix(f.Name(), "ttyS") {
|
||||
port, err := nativeOpen(portName, &Mode{})
|
||||
if err != nil {
|
||||
serr, ok := err.(*PortError)
|
||||
if ok && serr.Code() == InvalidSerialPort {
|
||||
continue
|
||||
}
|
||||
continue
|
||||
} else {
|
||||
port.Close()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user