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

Open
gdamore opened this issue Jan 24, 2021 · 2 comments
Open

proposal: x/term: expose tcflush functionality #43884

gdamore opened this issue Jan 24, 2021 · 2 comments
Labels
Projects
Milestone

Comments

@gdamore
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?

Yes

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

go env Output
$ go env

I'm the developer of the popular github.com/gdamore/tcell 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 golang.org/x/term 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
@ianlancetaylor
Copy link
Contributor

@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 golang.org/x/term. Do we want to just add stuff piecemeal?

Loading

@gdamore
Copy link
Author

@gdamore gdamore commented Jan 26, 2021

The easiest thing to do would be to just add a "tcflush" API. Sort of like here: https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.3.0/com.ibm.zos.v2r3.bpxbd00/rttcfu.htm

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.

Loading

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

Successfully merging a pull request may close this issue.

None yet
3 participants