| git.druid.rocks | index | druid520 | radium | lib/ | radium.scm |
lib/radium.scm
;;; radium.scm, call back into the running radium daemon from chez
;;
;; the scheme half of radium.lisp - see its own header for the real
;; reasoning (item 14, reusing ~/.radium.ipc/radium-ipc.el from item
;; 12 rather than inventing a second bridge). load into a real geiser
;; repl (M-x geiser-load-file on this file, or (load "path...") at
;; the chez prompt) and (radium-ipc "...") sends a real elisp form
;; into the running daemon.
;;
;; 'replace, not 'append: a fifo has no persistent content to append
;; to in the usual sense (every open+write+close just sends bytes to
;; whoever's reading right now), and chez's own open-output-file
;; refuses to open an already-existing path at all without an
;; explicit option saying that's fine - 'replace is that option,
;; checked directly against a real fifo, not assumed from an append-
;; oriented file api that doesn't actually apply here the way it does
;; for the common lisp side's :if-exists :append.
(define (radium-ipc form)
(let ([p (open-output-file
(string-append (getenv "HOME") "/.radium.ipc")
'replace)])
(put-string p form)
(newline p)
(close-port p)))