aboutsummaryrefslogtreecommitdiff
path: root/guix/store.scm
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2020-04-08 13:00:50 +0200
committerMarius Bakke <mbakke@fastmail.com>2020-04-08 13:00:50 +0200
commit27783023993f9272ce422868d14529159c4a5218 (patch)
tree9013b08aa39e497b1fd8e01a05254278d83f0ff7 /guix/store.scm
parentbe1e842ad78ac6c52fc7790f4a3ffd716673c111 (diff)
parentba6f2bda18ed19fa486a9c3e2c3baea6c66c6867 (diff)
downloadguix-27783023993f9272ce422868d14529159c4a5218.tar
guix-27783023993f9272ce422868d14529159c4a5218.tar.gz
Merge branch 'master' into core-updates
Conflicts: etc/news.scm gnu/local.mk gnu/packages/check.scm gnu/packages/cross-base.scm gnu/packages/gimp.scm gnu/packages/java.scm gnu/packages/mail.scm gnu/packages/sdl.scm gnu/packages/texinfo.scm gnu/packages/tls.scm gnu/packages/version-control.scm
Diffstat (limited to 'guix/store.scm')
-rw-r--r--guix/store.scm27
1 files changed, 19 insertions, 8 deletions
diff --git a/guix/store.scm b/guix/store.scm
index 12f66d0e71..6c7c07fd2d 100644
--- a/guix/store.scm
+++ b/guix/store.scm
@@ -624,14 +624,25 @@ connection. Use with care."
(define (call-with-store proc)
"Call PROC with an open store connection."
(let ((store (open-connection)))
- (dynamic-wind
- (const #f)
- (lambda ()
- (parameterize ((current-store-protocol-version
- (store-connection-version store)))
- (proc store)))
- (lambda ()
- (false-if-exception (close-connection store))))))
+ (define (thunk)
+ (parameterize ((current-store-protocol-version
+ (store-connection-version store)))
+ (let ((result (proc store)))
+ (close-connection store)
+ result)))
+
+ (cond-expand
+ (guile-3
+ (with-exception-handler (lambda (exception)
+ (close-connection store)
+ (raise-exception exception))
+ thunk))
+ (else ;Guile 2.2
+ (catch #t
+ thunk
+ (lambda (key . args)
+ (close-connection store)
+ (apply throw key args)))))))
(define-syntax-rule (with-store store exp ...)
"Bind STORE to an open connection to the store and evaluate EXPs;