fix: keep stdout to events in a removal

--remove and --backups opened the --manifest and --from-pack before
the event stream started: the list's platform and the pack name went to
stdout ahead of start, and a refusal of the pack came with no event.
They are opened inside the action now.
This commit is contained in:
Abdessamad Derraz committed 2026-11-21 19:50:46 +01:00
1 parent eba627aa89
commit c888ae8101
6 files changed
+52 -14

No files matched your search

+12 -2
View File
@@ -349,8 +349,7 @@ def _main_run() -> None:
_main_check_offline(parser, args)
install_bounded_opener()
if args.remove or args.backups:
_open_local_sources(args)
_run_action(args, run_removal if args.remove else run_backups)
_run_action(args, _with_local_sources(run_removal if args.remove else run_backups))
_main_check_sources(parser, args)
_main_dispatch(args)
@@ -431,6 +430,17 @@ def _check_pack(parser: argparse.ArgumentParser, args: argparse.Namespace) -> No
f"name): {name}")
def _with_local_sources(action: Callable[[argparse.Namespace], int],
) -> Callable[[argparse.Namespace], int]:
"""action, the list and the pack it was given opened first. Opened
before the action, they said the list's platform on stdout ahead of
start, the first line of --events no JSON."""
def opened(args: argparse.Namespace) -> int:
_open_local_sources(args)
return action(args)
return opened
def _run_action(args: argparse.Namespace,
action: Callable[[argparse.Namespace], int]) -> NoReturn:
"""Run an action and exit with its code, its events framed by start and