summaryrefslogtreecommitdiff
path: root/testsuite/tests/lib/IO/4808.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/lib/IO/4808.hs')
-rw-r--r--testsuite/tests/lib/IO/4808.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/testsuite/tests/lib/IO/4808.hs b/testsuite/tests/lib/IO/4808.hs
new file mode 100644
index 0000000000..97ca344bb4
--- /dev/null
+++ b/testsuite/tests/lib/IO/4808.hs
@@ -0,0 +1,12 @@
+import System.IO
+import GHC.IO.Handle
+import GHC.IO.FD as FD
+
+main = do
+ (fd, _) <- FD.openFile "4808.hs" ReadWriteMode False
+ hdl <- mkDuplexHandle fd "4808.hs" Nothing nativeNewlineMode
+ hClose hdl
+ (fd2, _) <- FD.openFile "4808.hs" ReadWriteMode False
+ print (fdFD fd == fdFD fd2) -- should be True
+ hGetLine hdl >>= print -- should fail with an exception
+