Skip to content

Conversation

@Naatan
Copy link
Contributor

@Naatan Naatan commented Jun 27, 2024

The original implementation gives responsibilities to output consumers that they should have not had. Essentially we ended up with a structure where termtest used output consumers, and output consumers in turn used termtest. This feels error-prone and difficult to reason about.

This rewrite fixes this by sending a Stop signal to consumers that are still pending, when the output producer reaches EOF (ie. process exited). This should also avoid any race conditions wrt consuming output shortly after the process exited, which was the main issue I was trying to fix.

I should've realized this when I reviewed the original PR, but it had been a while since I worked on this code.

Avoid cyclic dependencies; output consumers or producers should have no awareness of termtest
@CLAassistant
Copy link

CLAassistant commented Jun 27, 2024

CLA assistant check
All committers have signed the CLA.

@Naatan Naatan changed the base branch from master to v2-wip June 27, 2024 20:59
@Naatan Naatan requested a review from mitchell-as June 27, 2024 21:02
@Naatan
Copy link
Contributor Author

Naatan commented Jun 28, 2024

@mitchell-as sorry I had flagged you too early, there were failing tests on windows.

Turns out on Windows the PTY won't reach EOF unless I have instructed the library that I am waiting for it to close. This is a bug in the library, but for now we'll have to live with it. So the recent changes have us start waiting for the pty to close immediately via goroutine.

@Naatan Naatan requested a review from mitchell-as June 28, 2024 17:06
@Naatan Naatan merged commit 3b5b4ea into v2-wip Jun 28, 2024
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.

4 participants