[Haskell-cafe] System.Process and -threaded

Donn Cave donn at avvanta.com
Sat May 17 14:04:50 UTC 2014

quoth Karsten Gebbert,
> My questions are these: is there anything I need to take care of when
> handling sub-processes like this, specifically while writing to stdin of
> the process, and with particular regard to -threaded? Does anybody spot
> a problem or something I'm overlooking when handling processes like this? 

I can't say I know what's going wrong.

One thing you can do when using handles on a pipe, is put "hFlush hand"
after your "hPutStr hand"  - that will clean up problems with buffering.

Really a process level buffered I/O layer like this is very little help
for your application, and adds various complexities.  If you're interested,
you might extract the process handles' POSIX file descriptors and use
those - System.Posix.IO handleToFd, fdWrite, etc. - just as an experiment.
I don't see how the problems you report really suggest that you have a
buffering problem that would naturally be cured by this, though.

The other generic red flag here, for -threaded, is that the threaded
runtime uses POSIX signals to dispatch certain background functions.
That creates a flood of signal handling interrupts that can disrupt
library functions.  To find out if that's a problem, you may turn
that off, on the command line +RTS -V0 -RTS.


More information about the Haskell-Cafe mailing list