run_codex_tty: trim trailing whitespace and adjust logging

Accumulate screen output before writing, strip trailing newlines/spaces,
and print per-instance completion message. Drop final sorted result
logging in main.
This commit is contained in:
pakrym-oai
2026-01-22 07:31:11 -08:00
parent 27e399df8c
commit 1b7f02810b

View File

@@ -190,8 +190,15 @@ def run_instance(
out_dir.mkdir(parents=True, exist_ok=True)
out_path = out_dir / f"codex_{index}.txt"
with out_path.open("w", encoding="utf-8") as f:
text = ""
for line in screen.display:
f.write(line.rstrip() + "\n")
text += line.rstrip() + "\n"
text = text.rstrip("\n ")
f.write(text)
print(f"done {index}: {out_path}")
result_queue.put((index, out_path))
os.close(master_fd)
@@ -229,9 +236,7 @@ def main() -> int:
for thread in threads:
thread.join()
results = sorted(result_queue.get() for _ in range(args.instances))
for index, path in results:
print(f"instance {index}: {path}")
sorted(result_queue.get() for _ in range(args.instances))
return 0