add a write-to-file function for exporting stuff
This commit is contained in:
parent
35d0099e40
commit
fba4b359fa
@ -27,6 +27,14 @@
|
||||
|
||||
(define (roundx x) (inexact->exact (round x)))
|
||||
|
||||
(define (write-to-file obj filename)
|
||||
(let ((port (open-file filename "w")))
|
||||
(catch 'write-error
|
||||
;; thunk
|
||||
(lambda () (simple-format port "~a" obj) (force-output) (close port))
|
||||
;; handler
|
||||
(lambda () (close port) 'write-error))))
|
||||
|
||||
(define* (shell-command-to-string* cmd args)
|
||||
(let* ((port (apply open-pipe* (append (list OPEN_READ cmd) args)))
|
||||
(str (read-string port)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user