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

Two level timeout for windows codepath #43

Merged
merged 1 commit into from
May 27, 2020
Merged
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
15 changes: 12 additions & 3 deletions pygdbmi/gdbcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ def _get_responses_windows(self, timeout_sec):
timeout_time_sec = time.time() + timeout_sec
responses = []
while True:
responses_list = []
try:
self.gdb_process.stdout.flush()
if PYTHON3:
Expand All @@ -301,7 +302,7 @@ def _get_responses_windows(self, timeout_sec):
)
else:
raw_output = self.gdb_process.stdout.read().replace(b"\r", b"\n")
responses += self._get_responses_list(raw_output, "stdout")
responses_list = self._get_responses_list(raw_output, "stdout")
except IOError:
pass

Expand All @@ -313,11 +314,19 @@ def _get_responses_windows(self, timeout_sec):
)
else:
raw_output = self.gdb_process.stderr.read().replace(b"\r", b"\n")
responses += self._get_responses_list(raw_output, "stderr")
responses_list += self._get_responses_list(raw_output, "stderr")
except IOError:
pass

if time.time() > timeout_time_sec:
responses += responses_list
if timeout_sec == 0:
break
elif responses_list and self._allow_overwrite_timeout_times:
timeout_time_sec = min(
time.time() + self.time_to_check_for_additional_output_sec,
timeout_time_sec,
)
elif time.time() > timeout_time_sec:
break

return responses
Expand Down