#5761: Getting stdout and stderr as a single handle from createProcess does not
work on Windows
-----------------------------------------+----------------------------------
 Reporter:  SimonHengel                  |          Owner:                   
     Type:  bug                          |         Status:  new              
 Priority:  normal                       |      Component:  libraries/process
  Version:  7.2.1                        |       Keywords:                   
       Os:  Windows                      |   Architecture:  x86              
  Failure:  Incorrect result at runtime  |       Testcase:                   
Blockedby:                               |       Blocking:                   
  Related:                               |  
-----------------------------------------+----------------------------------
 The following test case works on Linux (an as far as I know on Mac OS X
 too), but not on Windows.
 {{{
 {-# OPTIONS_GHC -fno-warn-missing-signatures #-}
 module Spec (main) where
 import           Test.HUnit
 import           System.Process
 import           System.IO

 subprocess = concat $
   [ "module Main where\n"
   , "import System.IO\n"
   , "main = do\n"
   , "  hPutStr stderr \"foo\"\n"
   , "  hFlush stderr\n"
   , "  hPutStrLn stdout \"bar\"\n"
   , "  hFlush stdout\n"
   ]

 main = runTestTT $ TestCase $ do
   (Just hin, Just hout, Nothing, _) <-
     createProcess $ (proc "runhaskell" []) {
         std_in = CreatePipe
       , std_out = CreatePipe
       , std_err = UseHandle stdout
     }
   hPutStrLn hin subprocess
   hClose hin
   line <- hGetLine hout
   line @?= "foobar"
 }}}

 Do we consider this a bug?  If not, what would be the suggested way to do
 that?

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5761>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to