In the non-threaded runtime, the waitForProcess (waitpid()) call used in streamingProcess blocks the entire Haskell process, thus making the program block forever if the child process needs to be fed input by Haskell in order to terminate.
This is because waitpid() is not Fd-based and thus cannot use the non-blocking IO of the IO manager; see the waitForProcess docs here:
GHC Note: in order to call waitForProcess without blocking all the other threads in the system, you must compile the program with -threaded.
Detail repro with explanation: https://github.com/nh2/sourceProcessWithStreams-nonthreaded-problem
I use the nonthreaded runtime a lot, and I also use streamingProcess and conduits on top of it, so I'd like those to work with each other.
In the non
-threadedruntime, thewaitForProcess(waitpid()) call used instreamingProcessblocks the entire Haskell process, thus making the program block forever if the child process needs to be fed input by Haskell in order to terminate.This is because
waitpid()is not Fd-based and thus cannot use the non-blocking IO of the IO manager; see thewaitForProcessdocs here:Detail repro with explanation: https://github.com/nh2/sourceProcessWithStreams-nonthreaded-problem
I use the nonthreaded runtime a lot, and I also use
streamingProcessand conduits on top of it, so I'd like those to work with each other.