Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions serial_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ func (port *unixPort) Close() error {
}

func (port *unixPort) Read(p []byte) (int, error) {
// If the buffer is empty, instantly returns instead of returns with PortClosed error later
if len(p) == 0 {
return 0, nil
}
port.closeLock.RLock()
defer port.closeLock.RUnlock()
if atomic.LoadUint32(&port.opened) != 1 {
Expand Down