File remains locked after crash

Simon Marlow simonmarhaskell at gmail.com
Thu May 4 04:57:38 EDT 2006


Neil Mitchell wrote:

> Ross Paterson suggested an improved writeFile, which would close the
> file on error:
> 
>>         import Control.Exception
>>         import System.IO
>>
>>         writeFile' :: FilePath -> String -> IO ()
>>         writeFile' f txt = bracket (openFile f WriteMode) hClose
>>                                 (flip hPutStr txt)
> 
> Which might work better.

I've made that change, thanks.

Cheers,
	Simon



More information about the Glasgow-haskell-bugs mailing list