Created
December 14, 2018 10:00
-
-
Save rfolland/6458fcce83c73c4645cf8793771e1d75 to your computer and use it in GitHub Desktop.
Write JSON string to a UNIX domain socket
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This works: | |
echo '{"command" : ["set_property", "pause", "yes"] }' | socat - /tmp/DP-1-sock | |
This does not: | |
(defun pause-yes () | |
(ccl:with-open-socket (socket :connect :active | |
:address-family :file | |
:type :stream | |
:remote-filename "/tmp/DP-1-sock") | |
(format socket "{\"command\":[\"set_property\", \"pause\", \"yes\"]}"))) | |
Adding ~& for a newline at the end of the string fixed it (for pause-yes).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I also tried this with no success:
(defun pause2 ()
(with-input-from-string (stream "{"command":["set_property", "pause", "yes"]}")
(ccl:run-program "socat" (list "-" "/tmp/DP-1-sock")
:input stream
:output t)))