Skip to content
Snippets Groups Projects
Commit 99d88929 authored by Ludovic Courtès's avatar Ludovic Courtès
Browse files

'with-store' and 'with-database' and written in terms of 'unwind-protect'.

* src/cuirass/base.scm (with-store): Rewrite using 'unwind-protect'.
* src/cuirass/database.scm (with-database): Likewise.
parent e0e27098
No related branches found
No related tags found
No related merge requests found
......@@ -67,19 +67,18 @@
;; currently closes in a 'dynamic-wind' handler, which means it would close
;; the store at each context switch. Remove this when the real 'with-store'
;; has been fixed.
(let* ((store (open-connection))
(result (begin
;; Always set #:keep-going? so we don't stop on the first
;; build failure. Set #:print-build-trace explicitly to
;; make sure 'process-build-log' sees build events.
(set-build-options store
#:use-substitutes? (%use-substitutes?)
#:fallback? (%fallback?)
#:keep-going? #t
#:print-build-trace #t)
exp ...)))
(close-connection store)
result))
(let ((store (open-connection)))
(unwind-protect
;; Always set #:keep-going? so we don't stop on the first build failure.
;; Set #:print-build-trace explicitly to make sure 'process-build-log'
;; sees build events.
(set-build-options store
#:use-substitutes? (%use-substitutes?)
#:fallback? (%fallback?)
#:keep-going? #t
#:print-build-trace #t)
exp ...
(close-connection store))))
(cond-expand
(guile-2.2
......
......@@ -253,10 +253,8 @@ INSERT INTO Evaluations (specification, revision) VALUES ("
;; XXX: We don't install an unwind handler to play well with delimited
;; continuations and fibers. But as a consequence, we leak DB when BODY
;; raises an exception.
(let* ((db (db-open))
(result (begin body ...)))
(db-close db)
result))
(let ((db (db-open)))
(unwind-protect body ... (db-close db))))
(define* (read-quoted-string #:optional (port (current-input-port)))
"Read all of the characters out of PORT and return them as a SQL quoted
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment