Skip to content

Commit

Permalink
review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mmastrac committed Aug 7, 2024
1 parent bd80b69 commit 12fe27b
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions edb/testbase/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -2458,22 +2458,19 @@ async def read_stdout():
nonlocal output
# Tee the log temporarily to a tempfile that exists as long as the
# test is running. This helps debug hanging tests.
with tempfile.NamedTemporaryFile(mode='w+t',
prefix='edgedb-test-log-',
delete=False) as temp_file:
with tempfile.NamedTemporaryFile(
mode='w+t',
prefix='edgedb-test-log-') as temp_file:
if self.debug:
print(f"Logging to {temp_file.name}")
try:
while True:
line = await self.proc.stdout.readline()
if not line:
break
output += line
temp_file.write(line.decode(errors='ignore'))
if self.debug:
print(line.decode(errors='ignore'), end='')
finally:
os.remove(temp_file.name)
while True:
line = await self.proc.stdout.readline()
if not line:
break
output += line
temp_file.write(line.decode(errors='ignore'))
if self.debug:
print(line.decode(errors='ignore'), end='')

stdout_task = asyncio.create_task(read_stdout())

Expand Down

0 comments on commit 12fe27b

Please sign in to comment.