me
/
guix
Archived
1
0
Fork 0

store: 'with-store' returns as many values as its body.

Fixes <https://bugs.gnu.org/42912>.
Reported by Ricardo Wurmus <rekado@elephly.net>.

* guix/store.scm (call-with-store)[thunk]: Wrap call to PROC in
'call-with-values'.
* tests/store.scm ("with-store, multiple values"): New test.
master
Ludovic Courtès 2020-08-28 15:05:17 +02:00
parent b630840920
commit 3d9ea605c8
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 13 additions and 3 deletions

View File

@ -628,9 +628,10 @@ connection. Use with care."
(define (thunk)
(parameterize ((current-store-protocol-version
(store-connection-version store)))
(let ((result (proc store)))
(call-with-values (lambda () (proc store))
(lambda results
(close-connection store)
result)))
(apply values results)))))
(cond-expand
(guile-3

View File

@ -141,6 +141,15 @@
(string-append (%store-prefix) "/"
(make-string 32 #\e) "-foobar"))))
(test-equal "with-store, multiple values" ;<https://bugs.gnu.org/42912>
'(1 2 3)
(call-with-values
(lambda ()
(with-store s
(add-text-to-store s "foo" "bar")
(values 1 2 3)))
list))
(test-assert "valid-path? error"
(with-store s
(guard (c ((store-protocol-error? c) #t))