Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: x/term: expose tcflush functionality #43884

gdamore opened this issue Jan 24, 2021 · 2 comments

proposal: x/term: expose tcflush functionality #43884

gdamore opened this issue Jan 24, 2021 · 2 comments


Copy link

@gdamore gdamore commented Jan 24, 2021

What version of Go are you using (go version)?

$ go version
go version go1.14.2 linux/amd64

Does this issue reproduce with the latest release?


What operating system and processor architecture are you using (go env)?

go env Output
$ go env

I'm the developer of the popular package.

I'm skipping the rest of this questionaire as I think it's not terribly relevant to this feature request.

Essentially, I'd like to expose a method to flush I/O on the tty. This would permit us to ensure that we can pause the text UI, and not wind up sucking in a bunch of I/O when restoring back to raw mode.

Alternatively, having a version of term.MakeRaw (and probably also term.Restore) that let me specify TCSFLUSH behavior would also work.

@seankhliao seankhliao changed the title golang/x/term desire tcflush proposal: x/term: expose tcflush functionality Jan 24, 2021
@gopherbot gopherbot added this to the Proposal milestone Jan 24, 2021
@ianlancetaylor ianlancetaylor added this to Incoming in Proposals Jan 26, 2021
Copy link

@ianlancetaylor ianlancetaylor commented Jan 26, 2021

It will help us if you can suggest a specific function or method, with documentation. Thanks.

Also, it seems like there is quite a lot of Unix termios functionality that is not in Do we want to just add stuff piecemeal?


Copy link

@gdamore gdamore commented Jan 26, 2021

The easiest thing to do would be to just add a "tcflush" API. Sort of like here:

An alternative idea would be to create either an extended version of MakeRaw (say MakeRawExt()) that takes an "op" operation argument with one of the value Flush, Drain, or Now. This could also be added as optional argument to MakeRaw via an ...Options kind of varargs.

To be honest I think "tcflush" (call it TcFlush I guess) is the most flexible and powerful. I can then call that right before the other options, and you could support both flushing and draining on either input or output.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants