summaryrefslogtreecommitdiff
path: root/guix/scripts
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-05-25 22:52:41 +0200
committerLudovic Courtès <ludo@gnu.org>2015-05-25 22:52:41 +0200
commitdb030303b820297da23f8ce7101be88427eeef8d (patch)
tree471ad5271d7c026ebf5b698947a43c6d2df2e7c6 /guix/scripts
parent5f1087c48144e15d9e37d23b559017f9d7e326cd (diff)
downloadguix-patches-db030303b820297da23f8ce7101be88427eeef8d.tar
guix-patches-db030303b820297da23f8ce7101be88427eeef8d.tar.gz
guix system: Add '--on-error'.
* guix/ui.scm (load*): Add #:on-error parameter. [tag, error-string]: New variables. Wrap 'load' call in 'call-with-prompt'. Pass TAG to 'make-stack'. Honor ON-ERROR after 'report-load-error' call. (report-load-error): Change to not exit on error. Make private. * guix/scripts/system.scm (show-help, %options): Add --on-error. (guix-system): Use 'load*' and pass it #:on-error.
Diffstat (limited to 'guix/scripts')
-rw-r--r--guix/scripts/system.scm10
1 files changed, 9 insertions, 1 deletions
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 277f31f6f4..b6d7d0d045 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -383,6 +383,9 @@ Build the operating system declared in FILE according to ACTION.\n"))
(show-build-options-help)
(display (_ "
+ --on-error=STRATEGY
+ apply STRATEGY when an error occurs while reading FILE"))
+ (display (_ "
--image-size=SIZE for 'vm-image', produce an image of SIZE"))
(display (_ "
--no-grub for 'init', do not install GRUB"))
@@ -422,6 +425,10 @@ Build the operating system declared in FILE according to ACTION.\n"))
(option '(#\V "version") #f #f
(lambda args
(show-version-and-exit "guix system")))
+ (option '("on-error") #t #f
+ (lambda (opt name arg result)
+ (alist-cons 'on-error (string->symbol arg)
+ result)))
(option '("image-size") #t #f
(lambda (opt name arg result)
(alist-cons 'image-size (size->number arg)
@@ -514,7 +521,8 @@ Build the operating system declared in FILE according to ACTION.\n"))
(action (assoc-ref opts 'action))
(system (assoc-ref opts 'system))
(os (if file
- (read-operating-system file)
+ (load* file %user-module
+ #:on-error (assoc-ref opts 'on-error))
(leave (_ "no configuration file specified~%"))))
(dry? (assoc-ref opts 'dry-run?))