Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions rebench/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ def _indicate_progress(self, completed_task, run):

art_mean = run.get_mean_of_totals()
art_unit = run.total_unit
if art_unit is None:
art_unit = ""

hour, minute, sec = self._estimate_time_left()

Expand Down
36 changes: 26 additions & 10 deletions rebench/subprocess_with_timeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,40 @@ def process_output(self, proc):
self.stdout_result = ""
self.stderr_result = ""

stdout_eof = False
stderr_eof = False

while True:
reads = [proc.stdout.fileno()]
if self._stderr == PIPE:
reads = []

if proc.stdout and not proc.stdout.closed and not stdout_eof:
reads.append(proc.stdout.fileno())
if (self._stderr == PIPE and
proc.stderr and
not proc.stderr.closed and
not stderr_eof):
reads.append(proc.stderr.fileno())
ret = select(reads, [], [])

if not reads:
proc.wait()
break

ret = select(reads, [], [], 0.1)
for file_no in ret[0]:
if file_no == proc.stdout.fileno():
read = output_as_str(proc.stdout.readline())
Copy link

Copilot AI Jun 27, 2025

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.

Copilot uses AI. Check for mistakes.
sys.stdout.write(read)
self.stdout_result += read
if read == "":
stdout_eof = True
else:
sys.stdout.write(read)
self.stdout_result += read
if self._stderr == PIPE and file_no == proc.stderr.fileno():
read = output_as_str(proc.stderr.readline())
sys.stderr.write(read)
self.stderr_result += read

if proc.poll() is not None:
break
if read == "":
stderr_eof = True
else:
sys.stderr.write(read)
self.stderr_result += read
else:
stdout_r, stderr_r = proc.communicate()
self.stdout_result = output_as_str(stdout_r)
Expand Down