On 06 April 2005 16:16, Volker Wysk wrote:

> The following program demonstrates the bug:
> 
> import GHC.Handle
> import GHC.IOBase
> import GHC.Conc
> import IO
> 
> main = do
>    h <- openFile "/tmp/out" WriteMode
>    hDuplicateTo h stdout
> 
>    fdh <- getfd h
>    fdstdout <- getfd stdout
>    hPutStrLn stderr ("h: " ++ show fdh ++ "\nstdout: " ++ show
> fdstdout) 
> 
>    hClose h
>    putStrLn "bla"
> 
> 
> getfd h@(FileHandle _ mvar) = do
>    h__ <- takeMVar mvar
>    let fd = fromIntegral (haFD h__)
>    putMVar mvar h__
>    return fd
> 
> 
> The output:
> 
> h: 1
> stdout: 1
> dup: <stdout>: hPutChar: invalid argument (Bad file descriptor)

That's a bug, now fixed.  Thanks for the report.

Cheers,
        Simon
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to