|
forkProcess + stdin issue: msg#00029lang.haskell.glasgow.bugs
After using forkProcess the child cannot read from stdin (except for data already in the buffer). Using forkProcessAll or foreign importing C's fork makes the problem go away. This applies to Solaris and GHC 6.0, I have not tested other platforms. Example program: > module Main where > import Monad > import IO > import System.Posix > main = do > mPid <- forkProcess > case mPid of > Nothing -> -- Child. > forwardStdin > Just pid -> do -- Parent. > getProcessStatus True False pid > return () > forwardStdin = do > eof <- isEOF > when (not eof) $ do > c <- getChar > putChar c > forwardStdin Test output: $ echo "apa" | ./Test apa $ ./Test asdfasdf ^CTest: interrupted $ /NAD
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | very strange behavior (crashes!) with Dynamics, Hal Daume |
|---|---|
| Next by Date: | Microseconds in hWaitForInput, Nils Anders Danielsson |
| Previous by Thread: | RE: very strange behavior (crashes!) with Dynamics, Hal Daume |
| Next by Thread: | RE: forkProcess + stdin issue, Simon Marlow |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |