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
parent
b630840920
commit
3d9ea605c8
|
@ -628,9 +628,10 @@ connection. Use with care."
|
|||
(define (thunk)
|
||||
(parameterize ((current-store-protocol-version
|
||||
(store-connection-version store)))
|
||||
(let ((result (proc store)))
|
||||
(close-connection store)
|
||||
result)))
|
||||
(call-with-values (lambda () (proc store))
|
||||
(lambda results
|
||||
(close-connection store)
|
||||
(apply values results)))))
|
||||
|
||||
(cond-expand
|
||||
(guile-3
|
||||
|
|
|
@ -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))
|
||||
|
|
Reference in New Issue