diff options
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/doc-syms.tl | 1 | ||||
-rw-r--r-- | stdlib/getput.tl | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/stdlib/doc-syms.tl b/stdlib/doc-syms.tl index 5d056427..e9685e70 100644 --- a/stdlib/doc-syms.tl +++ b/stdlib/doc-syms.tl @@ -338,6 +338,7 @@ ("clock-t" "N-01B6F219") ("clockid-t" "N-01153D9E") ("close" "D-0016") + ("close-lazy-streams" "N-00B8ACD5") ("close-stream" "N-00596930") ("closedir" "N-01FEE88A") ("closelog" "N-02CEE7EA") diff --git a/stdlib/getput.tl b/stdlib/getput.tl index 0cf751a1..a1be729e 100644 --- a/stdlib/getput.tl +++ b/stdlib/getput.tl @@ -187,3 +187,9 @@ (defun command-put-jsons (cmd seq : flat-p mopt) (with-stream (s (open-command cmd `w@mopt`)) (put-jsons seq s flat-p))) + +(defmacro close-lazy-streams (. body) + ^(let ((sys:*lazy-streams*)) + (unwind-protect + (progn ,*body)) + (mapdo (fun close-stream) sys:*lazy-streams*))) |