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

[WIP] Add support for writing to ptys #3591

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

apostasie
Copy link
Contributor

This is the next step in removing unbuffer from our testing, adding the ability to write to stdin with ptys.

@apostasie
Copy link
Contributor Author

Failure is unrelated.

defer pty.Close()
defer tty.Close()

for _, writer := range gc.ptyWriters {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we use errgroup to wait for the routines?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes indeed.
Will update.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverting to draft for the time being - being abroad I may not have time to look into this immediately.

Thanks @AkihiroSuda .

@apostasie apostasie marked this pull request as draft October 24, 2024 13:54
@apostasie apostasie changed the title Add support for writing to ptys [WIP] Add support for writing to ptys Oct 30, 2024
}()
}

defer func() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
defer func() {
defer func() {
// Best effort.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this may help when debugging issues ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review @fahedouch

this is not ready though - I left it half assed a little while back, but will get it proper soon!

@@ -105,8 +107,18 @@ func (gc *GenericCommand) Run(expect *Expected) {
iCmdCmd.Stdin = tty
iCmdCmd.Stdout = tty
iCmdCmd.Stderr = tty
defer pty.Close()
defer tty.Close()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't move defer tty.Close()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not mandatory but you can just defer closing the tty before the goroutines loop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants