I've put together a simple test case for a rather annoying
problem. I've got a program that drives other programs. For
example, it can drive `cat`:
:; Simple cat a-file
When the file is a little bit greater than 135060 bytes, this
program fails to produce any output at all -- I need
On 2008 Nov 10, at 16:29, Jason Dusek wrote:
I've put together a simple test case for a rather annoying
problem. I've got a program that drives other programs. For
example, it can drive `cat`:
:; Simple cat a-file
When the file is a little bit greater than 135060 bytes, this
program fails
Yep, that's your problem. forkIO the hPut.
I can see the that thing biting a lot of people. Maybe there should be
a warning in docs that this particular combination:
feed input
read output
waitForProcess
is just likely to produce deadlocks?
All best
Christopher
simple exe bytes args= do
(i, o, e, p)- runInteractiveProcess exe args Nothing
Nothing
hPut i bytes
s - hGetContents o
hClose i
return s
Yep, that's your problem. forkIO the hPut.
Maybe I didn't do enough here -- just
This does not work either. It should cover all the bases,
right? Fork off input, pull things from ouput as they are
ready, stop when we reach end of file. If you remove the line
`print partial`, the program loops forever; if you keep it,
the program stops right there.
--
_jsn
import
On 2008 Nov 10, at 19:04, Jason Dusek wrote:
simple exe bytes args= do
(i, o, e, p)- runInteractiveProcess exe args Nothing
Nothing
hPut i bytes
s - hGetContents o
hClose i
return s
Yep, that's your problem. forkIO the hPut.
Maybe I
That was just me being absent-minded -- I have threaded in my
Cabal file but was not using it on the command line for my
little test script.
Thank you for calling it to my attention.
--
_jsn
___
Haskell-Cafe mailing list
Jason Dusek [EMAIL PROTECTED] writes:
simple exe bytes args= do
(i, o, e, p)- runInteractiveProcess exe args Nothing
Nothing
hPut i bytes
s - hGetContents o
hClose i
return s
Yep, that's your problem. forkIO the hPut.
I am using 6.8.3 -- it is almost exciting to realize how
close I came to 'impossible' instead of 'annoying'. Living on
the edge with UNIX IO!
--
_jsn
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org