go-serial icon indicating copy to clipboard operation
go-serial copied to clipboard

Timeout : return an error compatible with os.IsTimeout()

Open maitredede opened this issue 3 years ago • 7 comments

Like *net.Conn.Read() or *os.File.Read() when a timeout occurs, return an error that can be checked with os.IsTimeout()

maitredede avatar Aug 24 '21 21:08 maitredede

The actual behavior is "return 0 without error", that can also be understood as "end of stream". Network connections and file reads have their own timeout errors that can be detected with os.IsTimeout().

maitredede avatar Aug 24 '21 21:08 maitredede

This is exactly the issue i'm running into. I'm using io.ReadFull to fill a buffer directly from the port. However if a timeout is hit due to misconfiguration, it will loop forever. Thanks for fixing this!

zeroZshadow avatar Dec 31 '21 15:12 zeroZshadow