diff options
Diffstat (limited to 'maintainers/scripts/update.py')
-rw-r--r-- | maintainers/scripts/update.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/maintainers/scripts/update.py b/maintainers/scripts/update.py index 07e0b5c68305c..f1bed6527e797 100644 --- a/maintainers/scripts/update.py +++ b/maintainers/scripts/update.py @@ -13,6 +13,9 @@ import tempfile class CalledProcessError(Exception): process: asyncio.subprocess.Process +class UpdateFailedException(Exception): + pass + def eprint(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) @@ -69,7 +72,7 @@ async def run_update_script(nixpkgs_root: str, merge_lock: asyncio.Lock, temp_di eprint(f"--- SHOWING ERROR LOG FOR {package['name']} ----------------------") if not keep_going: - raise asyncio.exceptions.CancelledError() + raise UpdateFailedException(f"The update script for {package['name']} failed with exit code {e.process.returncode}") @contextlib.contextmanager def make_worktree() -> Generator[Tuple[str, str], None, None]: @@ -185,9 +188,14 @@ async def start_updates(max_workers: int, keep_going: bool, commit: bool, packag try: # Start updater workers. await updaters - except asyncio.exceptions.CancelledError as e: + except asyncio.exceptions.CancelledError: # When one worker is cancelled, cancel the others too. updaters.cancel() + except UpdateFailedException as e: + # When one worker fails, cancel the others, as this exception is only thrown when keep_going is false. + updaters.cancel() + eprint(e) + sys.exit(1) def main(max_workers: int, keep_going: bool, commit: bool, packages_path: str) -> None: with open(packages_path) as f: |