summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2006-03-16 20:33:35 +0000
committeraarne <aarne@cs.chalmers.se>2006-03-16 20:33:35 +0000
commite658e345fd225308cdf7c2c131198f85927b1dc3 (patch)
tree4156d58c2e57074a355e40778c422de32b57cfc7 /src
parentf156073a13539b26040dbe6bfec55816bffd0080 (diff)
exitFailure with gf -make
Diffstat (limited to 'src')
-rw-r--r--src/GF/GFModes.hs2
-rw-r--r--src/GF/Shell.hs9
2 files changed, 9 insertions, 2 deletions
diff --git a/src/GF/GFModes.hs b/src/GF/GFModes.hs
index bf3e90f97..dd25d1e49 100644
--- a/src/GF/GFModes.hs
+++ b/src/GF/GFModes.hs
@@ -90,7 +90,7 @@ putVerb st@(sh,_) s = if (oElem beSilent (globalOptions sh))
batchCompile :: Options -> FilePath -> IO ()
batchCompile os file = do
let file' = mkGFC file
- let st = initHState emptyShellState
+ let st = initHState $ addGlobalOptions (options [iOpt "make"]) emptyShellState
let s = "i -o" +++ (unwords $ map ('-':) $ words $ prOpts os) +++ file
let cs = pCommandLines st s
execLines True cs st
diff --git a/src/GF/Shell.hs b/src/GF/Shell.hs
index 062946649..1077616f5 100644
--- a/src/GF/Shell.hs
+++ b/src/GF/Shell.hs
@@ -65,6 +65,7 @@ import Data.Char (isDigit)
import Data.Maybe (fromMaybe)
import GF.System.Signal (runInterruptibly)
+import System.Exit (exitFailure)
---- import qualified GrammarToGramlet as Gr
---- import qualified GrammarToCanonXML2 as Canon
@@ -169,10 +170,16 @@ execLine :: Bool -> CommandLine -> ([String],HState) -> IO ([String],HState)
execLine put (c@(co, os), arg, cs) (outps,st) = do
(st',val) <- execC c (st, arg)
let tr = oElem doTrace os || null cs -- option -tr leaves trace in pipe
+ make = oElem (iOpt "make") os
+ isErr = case arg of
+ AError _ -> True
+ _ -> False
utf = if (oElem useUTF8 os) then encodeUTF8 else id
outp = if tr then [utf (prCommandArg val)] else []
if put then mapM_ putStrLnFlush outp else return ()
- execs cs val (if put then [] else outps ++ outp, st')
+ if make && isErr
+ then exitFailure
+ else execs cs val (if put then [] else outps ++ outp, st')
where
execs [] arg st = return st
execs (c:cs) arg st = execLine put (c, arg, cs) st