Commit 7f1d4ffc authored by Robert Goldman's avatar Robert Goldman
Browse files

Fix for issue 49.

Fix logic of invoking AFTER thunk.
parent 0fd4c2e6
...@@ -629,11 +629,16 @@ Finally, the file will be deleted, unless the KEEP argument when CALL-FUNCTION'e ...@@ -629,11 +629,16 @@ Finally, the file will be deleted, unless the KEEP argument when CALL-FUNCTION'e
(if want-pathname-p (if want-pathname-p
(funcall thunk stream pathname) (funcall thunk stream pathname)
(funcall thunk stream))))))) (funcall thunk stream)))))))
(cond ;; if we don't want a stream, then we must call the thunk *after*
((not okp) nil) ;; the stream is closed, but only if it was successfully opened.
(after (return (call-function after okp))) (when okp
((and want-pathname-p (not want-stream-p)) (return (call-function thunk okp))) (when (and want-pathname-p (not want-stream-p))
(t (return (values-list results))))) (setf results (multiple-value-list (funcall thunk okp))))
;; if the stream was successfully opened, then return a value,
;; either one computed already, or one from AFTER, if that exists.
(if after
(return (call-function after pathname))
(return (values-list results)))))
(when (and okp (not (call-function keep))) (when (and okp (not (call-function keep)))
(ignore-errors (delete-file-if-exists okp)))))) (ignore-errors (delete-file-if-exists okp))))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment