[Haskell-cafe] System.Posix, forked processes and psuedo terminals on Linux

Donn Cave donn at avvanta.com
Sat Aug 21 02:22:41 EDT 2010

Quoth Erik de Castro Lopo <mle+hs at mega-nerd.com>,
> The code below *almost* works. Its currently printing out:
>     parent : Forked child was here!
>     parent : Message from parent.
>     Read 21 bytes
> while I think it should print:
>     parent : Forked child was here!
>     parent : Read 21 bytes
> Any clues on why 'Message from parent.' is also ending up on
> stdout? This is ghc-6.12.1 on Debian Linux.

My guess is that the default tty attributes include ECHO.  So the
data you write to the master fd is echoed back, as though by the
fork process but actually by the terminal driver.  You can turn
ECHO off.

	Donn Cave, donn at avvanta.com

More information about the Haskell-Cafe mailing list