Skip to content

Commit

Permalink
Ref #46 - altered flush() for posx to use tcdrain rather than tcflush
Browse files Browse the repository at this point in the history
  • Loading branch information
euantorano committed Mar 28, 2022
1 parent d1f900d commit 2dbf9a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/serial/private/serialport/serialport_posix.nim
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ proc flush*(port: SerialPort | AsyncSerialPort) =
if not port.isOpen():
raise newException(InvalidSerialPortStateError, "Port must be open in order to be flushed")

if tcflush(cint(port.handle), TCIOFLUSH) == -1:
if tcdrain(cint(port.handle)) == -1:
raiseOSError(osLastError())

proc close*(port: SerialPort | AsyncSerialPort) =
Expand Down

0 comments on commit 2dbf9a9

Please sign in to comment.