From 3e299768664a89b4d966a32ce7213fad8f8ce4b2 Mon Sep 17 00:00:00 2001 From: ergosteur Date: Sun, 16 Aug 2026 22:48:40 -0400 Subject: [PATCH] fix: line-buffer sync output so a redirected log shows progress live A sync runs for hours and is normally watched through a redirected log, where Python's block buffering withheld the per-source progress lines until they happened to flush. The gallery-dl subprocesses write to the same descriptor unbuffered, so the log also interleaved out of order. Reconfiguring the streams in-process rather than relying on `python3 -u` means it holds however the script is invoked. Co-Authored-By: Claude Opus 5 --- scripts/gdl-sync.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/gdl-sync.py b/scripts/gdl-sync.py index d7e2460..4a44243 100755 --- a/scripts/gdl-sync.py +++ b/scripts/gdl-sync.py @@ -484,6 +484,13 @@ def publish(staging: Path, dest: str, dry_run: bool) -> int: def main() -> int: + # A sync runs for hours and is normally watched through a redirected log, + # where Python's block buffering would withhold progress until it happened + # to flush -- and the gallery-dl subprocesses write to the same descriptor + # unbuffered, so the log would also interleave out of order. + sys.stdout.reconfigure(line_buffering=True) + sys.stderr.reconfigure(line_buffering=True) + ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) ap.add_argument("--index", required=True,