read/write json blocking with medea added by caolanm on Mon Apr 10 12:24:57 2017

;; medea
(use medea)

(receive (in-a out-a in-b out-b) (unix-pair)
  (write-json '((hello . "world")) out-a)
  (print (read-json in-b)))

;; the above hangs...


;; but these work:

;; s-expressions
(receive (in-a out-a in-b out-b) (unix-pair)
  (write '((hello . "world")) out-a)
  (print (read in-b)))

;; => ((hello . "world"))

;; bencode
(use bencode)

(receive (in-a out-a in-b out-b) (unix-pair)
  (write-bencode '((hello . "world")) out-a)
  (print (read-bencode in-b)))

;; => ((hello . "world"))