liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit d2215d3e567f94c98c5355e66227b07a77555046
parent 3cf2308bee15bfe88126832720f18f9da56e786f
Author: Daniel Barlow <dan@telent.net>
Date:   Sat, 31 Aug 2024 22:18:23 +0100

tangc popen retry on short read

Diffstat:
Mpkgs/tangc/tangc.fnl | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/pkgs/tangc/tangc.fnl b/pkgs/tangc/tangc.fnl @@ -18,6 +18,10 @@ (if (< written (# str)) (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] (let [env (ll.environ) argv (doto params (table.insert 1 "jose")) @@ -29,7 +33,7 @@ (ll.close in) (let [output (accumulate [o "" - buf #(match (ll.read out) "" nil s s)] + buf #(match (read-all out) "" nil s s)] (.. o buf))] (values (exited pid) output))))