tangc popen retry on short read
This commit is contained in:
parent
3cf2308bee
commit
d2215d3e56
@ -18,6 +18,10 @@
|
|||||||
(if (< written (# str))
|
(if (< written (# str))
|
||||||
(write-all fd (string.sub str (+ written 1) -1)))))
|
(write-all fd (string.sub str (+ written 1) -1)))))
|
||||||
|
|
||||||
|
(fn read-all [fd]
|
||||||
|
(let [buf (ll.read fd)]
|
||||||
|
(if (> (# buf) 0) (.. buf (read-all fd)) buf)))
|
||||||
|
|
||||||
(fn jose [params inputstr]
|
(fn jose [params inputstr]
|
||||||
(let [env (ll.environ)
|
(let [env (ll.environ)
|
||||||
argv (doto params (table.insert 1 "jose"))
|
argv (doto params (table.insert 1 "jose"))
|
||||||
@ -29,7 +33,7 @@
|
|||||||
(ll.close in)
|
(ll.close in)
|
||||||
(let [output
|
(let [output
|
||||||
(accumulate [o ""
|
(accumulate [o ""
|
||||||
buf #(match (ll.read out) "" nil s s)]
|
buf #(match (read-all out) "" nil s s)]
|
||||||
(.. o buf))]
|
(.. o buf))]
|
||||||
(values (exited pid) output))))
|
(values (exited pid) output))))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user