Commit 356a4c12 authored by simonmar's avatar simonmar
Browse files

[project @ 2005-04-06 22:17:44 by simonmar]

hDuplicateTo test
parent 869ede1b
......@@ -79,3 +79,5 @@ clean(['readwrite002.inout'])
test('hGetBuf001', compose(only_compiler_types(['ghc']),
expect_fail_if_windows), compile_and_run, ['-package unix'])
test('hDuplicateTo001', normal, compile_and_run, [''])
import GHC.Handle
import GHC.IOBase
import GHC.Conc
import IO
main = do
h <- openFile "tmp" 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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment