scripts: environment: Improve error messages.

* guix/scripts/environment.scm (guix-environment): Wrap procedure body with
  error handling form.
This commit is contained in:
David Thompson 2015-03-16 08:59:59 -04:00
parent 2f094a69f0
commit 5762f3062c

View File

@ -220,21 +220,22 @@ packages."
(define (handle-argument arg result) (define (handle-argument arg result)
(alist-cons 'package arg result)) (alist-cons 'package arg result))
(with-store store (with-error-handling
(let* ((opts (parse-command-line args %options (list %default-options) (with-store store
#:argument-handler handle-argument)) (let* ((opts (parse-command-line args %options (list %default-options)
(pure? (assoc-ref opts 'pure)) #:argument-handler handle-argument))
(command (assoc-ref opts 'exec)) (pure? (assoc-ref opts 'pure))
(inputs (packages->transitive-inputs (command (assoc-ref opts 'exec))
(pick-all (options/resolve-packages opts) 'package))) (inputs (packages->transitive-inputs
(drvs (run-with-store store (pick-all (options/resolve-packages opts) 'package)))
(mbegin %store-monad (drvs (run-with-store store
(set-guile-for-build (default-guile)) (mbegin %store-monad
(build-inputs inputs opts))))) (set-guile-for-build (default-guile))
(cond ((assoc-ref opts 'dry-run?) (build-inputs inputs opts)))))
#t) (cond ((assoc-ref opts 'dry-run?)
((assoc-ref opts 'search-paths) #t)
(show-search-paths inputs drvs pure?)) ((assoc-ref opts 'search-paths)
(else (show-search-paths inputs drvs pure?))
(create-environment inputs drvs pure?) (else
(system command)))))) (create-environment inputs drvs pure?)
(system command)))))))