|
RE: runInteractiveProcess, confused: msg#00119lang.haskell.glasgow.bugs
On 18 May 2005 14:47, Frederik Eaton wrote: > When I run the following line in ghci: > > Prelude System.Process Control.Concurrent System.IO> do { (inp, out, > err, ph) <- runInteractiveProcess "cat" [] Nothing Nothing; forkIO > (do hPutStr inp "this\nis\na\ntest\n"; hClose inp); waitForProcess ph > } > > ... it doesn't terminate. I'm following the example in the > System.Process documentation. But I would think that since I close > 'inp', "cat" would terminate. Also, I don't see the expected output. This example won't work inside GHCi, because GHCi isn't compiled with -threaded: the -threaded option is required to get a version of waitForProcess that doesn't block other threads in a multithreaded program. The only reason GHCi isn't compiled with -threaded is because I'm being conservative; the threaded RTS introduces a lot more complexity and hasn't been shaken down as much as the single-threaded RTS. If you compile GHC up yourself you can fix it by adding "GhcStage2HcOpts += -threaded" to mk/build.mk before building. In a future release of GHC we'll do this by default. Cheers, Simon
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | [ ghc-Bugs-1198765 ] make depend of ghc-6.5 segfaults on x86-64, SourceForge.net |
|---|---|
| Next by Date: | [ ghc-Bugs-1198765 ] make depend of ghc-6.5 segfaults on x86-64, SourceForge.net |
| Previous by Thread: | runInteractiveProcess, confused, Frederik Eaton |
| Next by Thread: | Feature request: Windows ZIP Distribution, Brian Smith |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |