From 5788f5385417960e03411378eef5df452d768600 Mon Sep 17 00:00:00 2001 From: Peter van Arkel Date: Sat, 23 May 2026 00:31:24 +0200 Subject: [PATCH] (bugfix) Keep rsync runner callback optional Only pass the process_started hook when live run state tracking is active, so existing rsync call sites and tests without that hook remain compatible. Refs #54 --- src/pobsync/commands/run_scheduled.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/pobsync/commands/run_scheduled.py b/src/pobsync/commands/run_scheduled.py index 2268ed5..b8acf10 100644 --- a/src/pobsync/commands/run_scheduled.py +++ b/src/pobsync/commands/run_scheduled.py @@ -366,13 +366,14 @@ def run_scheduled( } ) - result = run_rsync( - cmd, - log_path=log_path, - timeout_seconds=timeout_seconds, - cancel_check=cancel_check, - process_started=process_started if state_callback is not None else None, - ) + run_rsync_kwargs: dict[str, Any] = { + "log_path": log_path, + "timeout_seconds": timeout_seconds, + "cancel_check": cancel_check, + } + if state_callback is not None: + run_rsync_kwargs["process_started"] = process_started + result = run_rsync(cmd, **run_rsync_kwargs) log_tail = _read_log_tail(log_path) warning = classify_rsync_warning(result.exit_code, log_tail) successful_or_warning = result.exit_code == 0 or warning is not None