[GHC] #4119: File buffering isn't flushed at exit

GHC cvs-ghc at haskell.org
Sun Jun 13 16:10:18 EDT 2010


#4119: File buffering isn't flushed at exit
------------------------------------------+---------------------------------
  Reporter:  EyalLotem                    |          Owner:                
      Type:  bug                          |         Status:  closed        
  Priority:  normal                       |      Milestone:                
 Component:  libraries/base               |        Version:  6.12.1        
Resolution:  invalid                      |       Keywords:  file buffers  
Difficulty:                               |             Os:  Linux         
  Testcase:                               |   Architecture:  x86_64 (amd64)
   Failure:  Incorrect result at runtime  |  
------------------------------------------+---------------------------------
Changes (by igloo):

  * status:  new => closed
  * resolution:  => invalid


Comment:

 This is an example of how finalizers aren't guaranteed to be run. If you
 use `withFile` then the handle will be closed and the data written, even
 if there is an exception:
 {{{
 import System.IO

 main = withFile "test.txt" WriteMode $ \h ->
        hPutStrLn h "Hello world"
 }}}

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


More information about the Glasgow-haskell-bugs mailing list