ghci and ghc -threaded broken with pipes & forking
Jeremy Shaw
jeremy.shaw at linspireinc.com
Wed Feb 28 16:06:25 EST 2007
Hello,
Your first problem is just a line buffering issue. You need to
explicitly set the line buffer inside the child processes:
redir fstdin stdInput
hSetBuffering stdin LineBuffering
redir fstdout stdOutput
hSetBuffering stdout LineBuffering
This is because the forked child process in not hooked up to a tty, so
GHC decides that block buffering would be a good choice.
Once you fix that you will encounter some new race condition type
bugs. These bugs will show up, even *without* the -threaded flag.
hth,
j.
At Wed, 28 Feb 2007 13:29:17 -0600,
John Goerzen wrote:
>
> On Wed, Feb 28, 2007 at 10:40:18AM -0800, Jeremy Shaw wrote:
> > At Wed, 28 Feb 2007 11:15:04 -0600,
> > John Goerzen wrote:
> >
> > > You can see my test case with:
> > >
> > > darcs get '--tag=glasgow ml' http://darcs.complete.org/hsh
> > > ghc -fglasgow-exts --make -o test2 test2.hs
> >
> > I get an erro when I use that darcs command-line, and test2.hs does
> > not appear to be in the directory afterwards. Am I doing something
> > wrong ?
>
> Oops. I hadn't pushed out that tag yet. It's there now.
More information about the Glasgow-haskell-users
mailing list