20 Oct 2012 11:19
Blocking IO & FIFOs
Jason Dusek <jason.dusek <at> gmail.com>
2012-10-20 09:19:36 GMT
2012-10-20 09:19:36 GMT
Hi all, I am developing a coroutine-like interface to Bash. http://hpaste.org/76523 The idea is that one can send multiple "queries" to an interpreter and then collect the results of each query. How do we know when Bash is done with each query? Waiting for "no more output" seems ambiguous; so the way CoBash works is: * Each query gets a tmp dir with two named pipes in it. * The query is wrapped in redirections to the pipes. * The pipes are removed when the query completes. This does work, sort of: +Prelude> :load CoBash.hs [1 of 1] Compiling CoBash ( CoBash.hs, interpreted ) Ok, modules loaded: CoBash. *CoBash> tuple <at> (i,o,e,p) <- start e :: Handle i :: Handle o :: Handle p :: ProcessHandle tuple :: (Handle, Handle, Handle, ProcessHandle) *CoBash> query tuple "for n in {1..4}; do sleep 1; echo $n; done" ("1\n2\n3\n4\n","") it :: (ByteString, ByteString)(Continue reading)
RSS Feed