Skip to content

Commit

Permalink
_get_responses_windows uses same timeout mechanism as unix codepath (#37
Browse files Browse the repository at this point in the history
) (#43)
  • Loading branch information
H0bo committed May 27, 2020
1 parent cc804f0 commit 3c8c92e
Showing 1 changed file with 12 additions and 3 deletions.
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

0 comments on commit 3c8c92e

Please sign in to comment.