From 7c8fd9ea9e8d5b6e419aa8f0cd71463cba187524 Mon Sep 17 00:00:00 2001
From: simonmar <unknown>
Date: Thu, 8 Jul 1999 08:10:52 +0000
Subject: [PATCH] [project @ 1999-07-08 08:10:52 by simonmar] Back out rev 1.30
 - it broke a lot of things.

---
 ghc/lib/std/PrelHandle.lhs | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/ghc/lib/std/PrelHandle.lhs b/ghc/lib/std/PrelHandle.lhs
index 337184f2e26e..52d66821e42e 100644
--- a/ghc/lib/std/PrelHandle.lhs
+++ b/ghc/lib/std/PrelHandle.lhs
@@ -242,16 +242,7 @@ stdout = unsafePerformIO (do
 	    (bm, bf_size)  <- getBMode__ fo
 	    mkBuffer__ fo bf_size
 #endif
-	    hdl <- newHandle (Handle__ fo WriteHandle bm "stdout")
-	     -- when stdin and stdout are both connected to a terminal, ensure
-	     -- that anything buffered on stdout is flushed prior to reading from stdin.
-	     -- 
-	    hConnectTerms hdl stdin
-  	     -- when stderr and stdout are both connected to a terminal, ensure
-	     -- that anything buffered on stdout is flushed prior to writing to
-	     -- stderr.
-	    hConnectTo hdl stderr
-	    return hdl
+	    newHandle (Handle__ fo WriteHandle bm "stdout")
        _ -> do ioError <- constructError "stdout"
                newHandle (mkErrorHandle__ ioError)
   )
@@ -277,7 +268,12 @@ stdin = unsafePerformIO (do
 #endif
 	    (bm, bf_size) <- getBMode__ fo
 	    mkBuffer__ fo bf_size
-	    newHandle (Handle__ fo ReadHandle bm "stdin")
+	    hdl <- newHandle (Handle__ fo ReadHandle bm "stdin")
+	     -- when stdin and stdout are both connected to a terminal, ensure
+	     -- that anything buffered on stdout is flushed prior to reading from stdin.
+	     -- 
+	    hConnectTerms stdout hdl
+	    return hdl
        _ -> do ioError <- constructError "stdin"
                newHandle (mkErrorHandle__ ioError)
   )
@@ -302,7 +298,12 @@ stderr = unsafePerformIO (do
             fo <- makeForeignObj fo
 	    addForeignFinalizer fo (freeStdFileObject fo)
 #endif
-            newHandle (Handle__ fo WriteHandle NoBuffering "stderr")
+            hdl <- newHandle (Handle__ fo WriteHandle NoBuffering "stderr")
+	    -- when stderr and stdout are both connected to a terminal, ensure
+	    -- that anything buffered on stdout is flushed prior to writing to
+	    -- stderr.
+	    hConnectTo stdout hdl
+	    return hdl
 
        _ -> do ioError <- constructError "stderr"
                newHandle (mkErrorHandle__ ioError)
-- 
GitLab