forked from GitHub/gf-core
exitFailure with gf -make
This commit is contained in:
@@ -90,7 +90,7 @@ putVerb st@(sh,_) s = if (oElem beSilent (globalOptions sh))
|
|||||||
batchCompile :: Options -> FilePath -> IO ()
|
batchCompile :: Options -> FilePath -> IO ()
|
||||||
batchCompile os file = do
|
batchCompile os file = do
|
||||||
let file' = mkGFC file
|
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 s = "i -o" +++ (unwords $ map ('-':) $ words $ prOpts os) +++ file
|
||||||
let cs = pCommandLines st s
|
let cs = pCommandLines st s
|
||||||
execLines True cs st
|
execLines True cs st
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ import Data.Char (isDigit)
|
|||||||
import Data.Maybe (fromMaybe)
|
import Data.Maybe (fromMaybe)
|
||||||
|
|
||||||
import GF.System.Signal (runInterruptibly)
|
import GF.System.Signal (runInterruptibly)
|
||||||
|
import System.Exit (exitFailure)
|
||||||
|
|
||||||
---- import qualified GrammarToGramlet as Gr
|
---- import qualified GrammarToGramlet as Gr
|
||||||
---- import qualified GrammarToCanonXML2 as Canon
|
---- 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
|
execLine put (c@(co, os), arg, cs) (outps,st) = do
|
||||||
(st',val) <- execC c (st, arg)
|
(st',val) <- execC c (st, arg)
|
||||||
let tr = oElem doTrace os || null cs -- option -tr leaves trace in pipe
|
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
|
utf = if (oElem useUTF8 os) then encodeUTF8 else id
|
||||||
outp = if tr then [utf (prCommandArg val)] else []
|
outp = if tr then [utf (prCommandArg val)] else []
|
||||||
if put then mapM_ putStrLnFlush outp else return ()
|
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
|
where
|
||||||
execs [] arg st = return st
|
execs [] arg st = return st
|
||||||
execs (c:cs) arg st = execLine put (c, arg, cs) st
|
execs (c:cs) arg st = execLine put (c, arg, cs) st
|
||||||
|
|||||||
Reference in New Issue
Block a user