From ca4d26eec69007757352357359a14fd43b65d393 Mon Sep 17 00:00:00 2001 From: LordMZTE Date: Tue, 14 Nov 2023 13:29:27 +0100 Subject: [PATCH] sysupdate script: keep track of failures --- scripts/sysupdate.rkt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/scripts/sysupdate.rkt b/scripts/sysupdate.rkt index f9e6b88..ee18f61 100755 --- a/scripts/sysupdate.rkt +++ b/scripts/sysupdate.rkt @@ -8,12 +8,15 @@ #:usage-help "Update the system" #:once-each [("-n" "--noint") "Don't require user interaction" (noint #t)]) +(define failures '()) + (define (cmd exe . args) - (match (find-executable-path exe) - [#f (printf "skipping command ~a, command not found\n" (cons exe args))] - [exepath - (printf ">>> ~a\n" (cons exe args)) - (apply system* exepath args)])) + (match* ((find-executable-path exe) (cons exe args)) + [(#f argv) (printf "skipping command ~a, command not found\n" argv)] + [(exepath argv) + (printf ">>> ~a\n" argv) + (unless (apply system* exepath args) + (set! failures (cons argv failures)))])) (apply cmd (if (noint) '("paru" "-Syu" "--noconfirm") @@ -22,3 +25,6 @@ (cmd "rustup" "update") (cmd "update-nvim-plugins") (cmd "tldr" "--update") + +(unless (empty? failures) + (raise-user-error "The following commands failed:" failures))