MCPcopy Create free account
hub / github.com/apache/arrow / wait_until_ready

Method wait_until_ready

python/pyarrow/tests/test_gdb.py:99–125  ·  view source on GitHub ↗

Record output until the gdb prompt displays. Return recorded output.

(self)

Source from the content-addressed store, hash-verified

97 self.last_stdout_line = b""
98
99 def wait_until_ready(self):
100 """
101 Record output until the gdb prompt displays. Return recorded output.
102 """
103 # TODO: add timeout?
104 while (not self.last_stdout_line.startswith(b"(gdb) ") and
105 self.proc.poll() is None):
106 block = self.proc.stdout.read(4096)
107 if self.verbose:
108 sys.stdout.buffer.write(block)
109 sys.stdout.buffer.flush()
110 block, sep, last_line = block.rpartition(b"\n")
111 if sep:
112 self.last_stdout.append(self.last_stdout_line)
113 self.last_stdout.append(block + sep)
114 self.last_stdout_line = last_line
115 else:
116 assert block == b""
117 self.last_stdout_line += last_line
118
119 if self.proc.poll() is not None:
120 raise IOError("gdb session terminated unexpectedly")
121
122 out = b"".join(self.last_stdout).decode('utf-8')
123 self.last_stdout = []
124 self.last_stdout_line = b""
125 return out
126
127 def issue_command(self, line):
128 line = line.encode('utf-8') + b"\n"

Callers 2

run_commandMethod · 0.95
gdbFunction · 0.95

Calls 7

IOErrorFunction · 0.85
pollMethod · 0.80
readMethod · 0.45
writeMethod · 0.45
appendMethod · 0.45
decodeMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected