make victorialogsend ucspi-compatible
This commit is contained in:
@@ -72,14 +72,22 @@ Host: %s\
|
|||||||
:_msg msg
|
:_msg msg
|
||||||
:host hostname)
|
:host hostname)
|
||||||
chunk)))
|
chunk)))
|
||||||
|
(fn writefd [fd body]
|
||||||
|
(case (ll.write fd body)
|
||||||
|
(bytes) (when (< bytes (# body)) (writefd fd (string.sub body bytes)))
|
||||||
|
(nil errno)
|
||||||
|
(error (string.format "write to fd %d failed: %s" fd (ll.strerror errno))))
|
||||||
|
true)
|
||||||
|
|
||||||
(fn run []
|
(fn run []
|
||||||
(let [{ : auth : url } (parse-args arg)]
|
(let [{ : auth : url } (parse-args arg)
|
||||||
(ll.write 1 (http-header url.host url.path auth))
|
in-fd 6
|
||||||
|
out-fd 7]
|
||||||
|
(writefd out-fd (http-header url.host url.path auth))
|
||||||
(while (case (io.stdin:read "l")
|
(while (case (io.stdin:read "l")
|
||||||
line (ll.write 1 (process-line line))))
|
line (writefd out-fd (process-line line))))
|
||||||
(ll.write 1 (chunk "")))
|
(writefd out-fd (chunk ""))
|
||||||
(io.stderr:write (ll.read 0)))
|
(io.stderr:write (ll.read in-fd))))
|
||||||
|
|
||||||
|
|
||||||
{ : run }
|
{ : run }
|
||||||
|
Reference in New Issue
Block a user