diff options
author | Munyoki Kilyungi | 2023-07-11 15:24:39 +0300 |
---|---|---|
committer | Munyoki Kilyungi | 2023-07-21 14:36:38 +0300 |
commit | 77cd7c51c465095364d185274aa4afdcc51083c3 (patch) | |
tree | 53b403029e176f41ecad06c7375f49283e94f972 | |
parent | baec0ede474a974ef3160423b7dc82773b1f5a50 (diff) | |
download | gn-transform-databases-77cd7c51c465095364d185274aa4afdcc51083c3.tar.gz |
Create a new procedure for shadowing a file port
* dump/documentation.scm (dump): Export call-with-documentation.
(call-with-documentation): New function.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
-rw-r--r-- | dump/documentation.scm | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/dump/documentation.scm b/dump/documentation.scm index 4c0fd88..81eec43 100644 --- a/dump/documentation.scm +++ b/dump/documentation.scm @@ -4,7 +4,9 @@ dump-configuration? dump-configuration-triples? dump-configuration-table-metadata? - dump-configuration-path)) + dump-configuration-path + call-with-documentation)) + (define-immutable-record-type <dump-configuration> (%dump-configuration triples? table-metadata? path) @@ -22,3 +24,12 @@ (%dump-configuration triples? table-metadata? path)) +(define (call-with-documentation conf proc) + (let ((port #f) + (path (dump-configuration-path conf))) + (when path + (dynamic-wind + (lambda () + (set! port (open-file path "w"))) + (cut proc port) + (cut close port))))) |