-
Notifications
You must be signed in to change notification settings - Fork 25
Make sure to read all data from stdout and stderr #290
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
Conversation
Instead of stopping when the process terminate, continue reading until all channels are closed. Signed-off-by: Stefan Marr <git@stefan-marr.de>
The previous code lifelocked on the EOF markers, i.e., empty strings. Signed-off-by: Stefan Marr <git@stefan-marr.de>
Signed-off-by: Stefan Marr <git@stefan-marr.de>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request enhances the subprocess output reading in verbose mode by ensuring that output from both stdout and stderr is fully captured until their respective channels are closed or an EOF marker is encountered, while ensuring the process termination is awaited.
- Introduces EOF flags (stdout_eof and stderr_eof) for both stdout and stderr
- Updates the read loop to check for closed channels and wait for process termination when no further data is available
- Adjusts the select mechanism to read with a timeout
Comments suppressed due to low confidence (1)
rebench/subprocess_with_timeout.py:94
- [nitpick] Add inline comments to explain the purpose and usage of the stdout_eof and stderr_eof flags to enhance code clarity.
stdout_eof = False
| ret = select(reads, [], [], 0.1) | ||
| for file_no in ret[0]: | ||
| if file_no == proc.stdout.fileno(): | ||
| read = output_as_str(proc.stdout.readline()) |
Copilot
AI
Jun 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider refactoring the duplicated logic for handling stdout and stderr reads into a helper function to improve maintainability and reduce code repetition.
Signed-off-by: Stefan Marr <git@stefan-marr.de>
|
Sorry, missed this. I've done no extensive testing, but I can confirm that this fixes my issue as defined in #289, indeed. Thanks! |
This PR changes how data is read from a benchmarking process when we run in verbose mode.
We need to make sure we read all data, thus:
Before returning, we need to wait for the process to terminate, so that we have the return code.
This fixes #289.
@OctaveLarose could you review this?
I debugged it and tried it out on yuria2.