[project @ 2002-04-18 12:15:56 by simonmar]
authorsimonmar <unknown>
Thu, 18 Apr 2002 12:15:56 +0000 (12:15 +0000)
committersimonmar <unknown>
Thu, 18 Apr 2002 12:15:56 +0000 (12:15 +0000)
Check the exit status of the generated C program when we run it, and
exit if it failed (partly from Axel Simon).

ghc/utils/hsc2hs/Main.hs

index 00ff523..95aae88 100644 (file)
@@ -1,5 +1,5 @@
 ------------------------------------------------------------------------
--- $Id: Main.hs,v 1.37 2002/02/13 10:39:36 simonpj Exp $
+-- $Id: Main.hs,v 1.38 2002/04/18 12:15:56 simonmar Exp $
 --
 -- Program for converting .hsc files to .hs files, by converting the
 -- file into a C program which is run to generate the Haskell source.
@@ -516,8 +516,11 @@ output flags name toks = do
         _                 -> return ()
     removeFile oProgName
     
-    system (execProgName++" >"++outName)
+    progStatus <- system (execProgName++" >"++outName)
     removeFile progName
+    case progStatus of
+        e@(ExitFailure _) -> exitWith e
+        _                 -> return ()
     
     when needsH $ writeFile outHName $
         "#ifndef "++includeGuard++"\n\