Ticket #3890 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

runghc sometimes won't allow redirecting of stdout/stderr

Reported by: simonmic Owned by: simonmar
Priority: high Milestone: 6.12.3
Component: Runtime System Version: 6.10.4
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description (last modified by igloo) (diff)

See attached test.hs. Here's stdout working normally:

$ runhaskell test.hs | cat
output
$

But after uncommenting either the cmdArgs line or the defaultMainWithArgs line, stdout can't be captured:

$ runhaskell test.hs | cat
$ 

It does appear on the console if you don't redirect though. The same goes for stderr. This prevents me testing uncompiled scripts with shelltestrunner. I'm on mac os 10.5.

Attachments

test.hs Download (1.2 KB) - added by simonmic 3 years ago.

Change History

Changed 3 years ago by simonmic

Changed 3 years ago by simonmic

stdout working normally:
 
$ runhaskell test.hs | cat
output
$
 
after uncommenting either commented line below, stdout can't be captured:
 
$ runhaskell test.hs | cat
$ 

Changed 3 years ago by canadaduane

I just bumped into this bug as well. When running tests in an editor such as TextMate?, this causes the editor to be unable to show the results of the test suite.

In my case, this is true of a simple

main = defaultMain tests

I assume this is caused by Test.Framework somehow?

Changed 3 years ago by igloo

  • description modified (diff)

Changed 3 years ago by igloo

  • priority changed from normal to high
  • milestone set to 6.12.3

With 6.13.20100428:

q.hs:

module Main (main) where

import System.Exit

main :: IO ()
main = do putStrLn "Q1"
          exitFailure
          putStrLn "Q2"
$ /home/ian/ghc/darcs/ghc/inplace/lib/runghc -f /home/ian/ghc/darcs/ghc/inplace/bin/ghc-stage2 q.hs
Q1
$ /home/ian/ghc/darcs/ghc/inplace/lib/runghc -f /home/ian/ghc/darcs/ghc/inplace/bin/ghc-stage2 q.hs | cat
$

Changed 3 years ago by simonmar

  • owner set to simonmar

Changed 3 years ago by simonmar

  • status changed from new to merge

Fixed:

Wed May  5 14:38:48 BST 2010  Simon Marlow <marlowsd@gmail.com>
  * runghc: flush stdout/stderr on an exception (#3890)

Changed 3 years ago by igloo

  • status changed from merge to closed
  • resolution set to fixed

Merged

Note: See TracTickets for help on using tickets.