summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-12-18 22:49:40 +0100
committerLudovic Courtès <ludo@gnu.org>2021-12-18 22:51:55 +0100
commitf6e79ef108a206a2fb3db550d76de760d581f8a8 (patch)
tree93bcda45b9f447cebff8671c83ca2f0e976fadc7 /guix
parenta9892f8f2daceb5bc8595e4d01611936e2c403a4 (diff)
style: Gracefully handle errors such as EACCES when opening files.
* guix/scripts/style.scm (guix-style): Wrap body in 'with-error-handling'.
Diffstat (limited to 'guix')
-rw-r--r--guix/scripts/style.scm23
1 files changed, 12 insertions, 11 deletions
diff --git a/guix/scripts/style.scm b/guix/scripts/style.scm
index 01196eb3e4..3b246e9c66 100644
--- a/guix/scripts/style.scm
+++ b/guix/scripts/style.scm
@@ -543,14 +543,15 @@ Update package definitions to the latest style.\n"))
edit-expression/dry-run
edit-expression))
(policy (assoc-ref opts 'input-simplification-policy)))
- (for-each (lambda (package)
- (simplify-package-inputs package #:policy policy
- #:edit-expression edit))
- ;; Sort package by source code location so that we start editing
- ;; files from the bottom and going upward. That way, the
- ;; 'location' field of <package> records is not invalidated as
- ;; we modify files.
- (sort (if (null? packages)
- (fold-packages cons '() #:select? (const #t))
- packages)
- (negate package-location<?)))))
+ (with-error-handling
+ (for-each (lambda (package)
+ (simplify-package-inputs package #:policy policy
+ #:edit-expression edit))
+ ;; Sort package by source code location so that we start editing
+ ;; files from the bottom and going upward. That way, the
+ ;; 'location' field of <package> records is not invalidated as
+ ;; we modify files.
+ (sort (if (null? packages)
+ (fold-packages cons '() #:select? (const #t))
+ packages)
+ (negate package-location<?))))))