hsc2hs does not fail

Axel Simon A.Simon@ukc.ac.uk
Tue, 16 Apr 2002 11:37:13 +0100 (BST)


Hi,

for some reason hsc2hs does not fail if the automatically generated
program fails to execute. This only happends if I forget to set
LD_LIBRARY_PATH before saying make. But it leads to a confusing error
messages when an empty .hs file is left and ghc complaints with "file name
does not match module name".

The patch below was done against ghc-5.02.2 on FreeBSD.

Cheers,
Axel.



*** Main.hs~    Fri Sep 14 17:15:11 2001
--- Main.hs     Tue Apr 16 11:29:28 2002
***************
*** 504,510 ****
          _                 -> return ()
      removeFile oProgName

!     system (execProgName++" >"++outName)
      removeFile progName

      when needsH $ writeFile outHName $
--- 504,513 ----
          _                 -> return ()
      removeFile oProgName

!     progStatus <- system (execProgName++" >"++outName)
!     case progStatus of
!         e@(ExitFailure _) -> exitWith e
!       _                 -> return ()
      removeFile progName

      when needsH $ writeFile outHName $