Re: [go-nuts] Re: Flushing keyboard buffer (cross platform) ?

2019-05-04 Thread Robert Engels
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

Re: [go-nuts] Re: Flushing keyboard buffer (cross platform) ?

2019-05-04 Thread roger peppe
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

Re: [go-nuts] Re: Flushing keyboard buffer (cross platform) ?

2019-05-03 Thread Robert Engels
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

Re: [go-nuts] Re: Flushing keyboard buffer (cross platform) ?

2019-05-03 Thread Matt Harden
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

[go-nuts] Re: Flushing keyboard buffer (cross platform) ?

2019-05-03 Thread gbarr
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