orthecreedence / cl-async

Asynchronous IO library for Common Lisp.
MIT License
273 stars 40 forks source link

Can't make pipes work #202

Open dangerdyke opened 8 months ago

dangerdyke commented 8 months ago

pipe-server is undocumented, and i can't figure out how to make it work. assuiming it creates a unix pipe, while i have the event loop running with a pipe-server i would expect to be able to send data over the pipe externally, with something like so:

 (as:with-event-loop ()
   ;; IPC pipe listener
   (as:pipe-server "my-pipe"
                   (lambda (sock data)
                     (format t "Received data on IPC pipe: ~a~%" data)
                     (as:write-socket-data sock "OK" :write-cb #'as:close-socket)))
$ echo "hello world" > my-pipe

however, if i run that lisp code and try to write to the pipe as described, I get this error:

$ echo "hello world" > ./my-pipe
warning: An error occurred while redirecting file './my-pipe'
open: No such device or address

this is in spite of there clearly being a file at ./my-pipe.

Could I get some clarification on how exactly this is supposed to work?