biscuit/pkgs/maps/fake-nmea.fnl

11 lines
320 B
Plaintext
Raw Normal View History

(local { : sleep } (require :posix.unistd))
(let [[filename socketname] arg
socket (io.popen (.. "socat - unix-listen:" socketname) :w)]
(with-open [handle (io.open filename :r)]
(each [l (handle:lines "L")]
(if (string.match l "GNS") (sleep 1))
(socket:write l)
(socket:flush)
)))