Correct, and with Go’s lightweight IO, the timeouts are cheap, so a simple read
with short timeouts is all you need to flush.
> On May 4, 2019, at 3:32 PM, roger peppe wrote:
>
>
>
>> On Sat, 4 May 2019, 04:33 Robert Engels, wrote:
>> Since people keep referring to “flush”. I’ll chime in
On Sat, 4 May 2019, 04:33 Robert Engels, wrote:
> Since people keep referring to “flush”. I’ll chime in again. Thus is not
> the correct way to do this, as many routines buffer input. Flushing the
> driver does nothing to characters already in the buffer. Flushing the
> driver is only
Since people keep referring to “flush”. I’ll chime in again. Thus is not the
correct way to do this, as many routines buffer input. Flushing the driver does
nothing to characters already in the buffer. Flushing the driver is only
appropriate if also doing direct reads from the driver - if you
You may want http://godoc/github.com/pkg/term/termios. It looks like it
supports Tcflush on UNIX, including Solaris:
https://github.com/pkg/term/blob/master/termios/termios_solaris.go#L63.
On Fri, May 3, 2019 at 9:45 AM gbarr wrote:
> For BSD systems I think you need to use TIOCFLUSH instead of
For BSD systems I think you need to use TIOCFLUSH instead of TCFLSH
On Friday, May 3, 2019 at 1:28:36 PM UTC+1, Steve Mynott wrote:
>
> I've a terminal app where I read y/n confirm using fmt.Scanln and I'm
> trying to flush the keyboard buffer before this.
>
> On linux (and probably other UNIX