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

Reimplement process exit expect failure #13

Merged
merged 9 commits into from
Jun 28, 2024
Merged

Reimplement process exit expect failure #13

merged 9 commits into from
Jun 28, 2024

Conversation

Naatan
Copy link
Member

@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
Member 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
4 checks passed
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