[project @ 2002-04-04 08:49:46 by simonmar]
authorsimonmar <unknown>
Thu, 4 Apr 2002 08:49:46 +0000 (08:49 +0000)
committersimonmar <unknown>
Thu, 4 Apr 2002 08:49:46 +0000 (08:49 +0000)
An I/O error while opening/writing the output file is *not* a panic.

ghc/compiler/main/CodeOutput.lhs

index 9e0dada..166c099 100644 (file)
@@ -93,12 +93,7 @@ codeOutput dflags mod_name tycons core_binds stg_binds
        }
 
 doOutput :: String -> (Handle -> IO ()) -> IO ()
-doOutput filenm io_action
-  = (do        handle <- openFile filenm WriteMode
-       io_action handle
-       hClose handle)
-    `catch` (\err -> pprPanic "Failed to open or write code output file" 
-                             (text filenm))
+doOutput filenm io_action = bracket (openFile filenm WriteMode) hClose io_action
 \end{code}