detect parse failure where command is somehow empty (wtf?)
This commit is contained in:
parent
90d4ada06e
commit
d5981949e0
1 changed files with 3 additions and 1 deletions
|
@ -124,13 +124,15 @@ runParser' p s paramfile = either failedparse id (parse p "" s)
|
||||||
failedparse e = error $
|
failedparse e = error $
|
||||||
(show e) ++
|
(show e) ++
|
||||||
"\n<<<\n" ++ s ++ "\n>>>" ++
|
"\n<<<\n" ++ s ++ "\n>>>" ++
|
||||||
"\nparam file contained: <<<\n" ++ paramfile ++ "\n>>>"
|
"\nparam file contained: >>>\n" ++ paramfile ++ "\n<<<"
|
||||||
|
|
||||||
atFile :: FilePath -> String
|
atFile :: FilePath -> String
|
||||||
atFile f = '@':f
|
atFile f = '@':f
|
||||||
|
|
||||||
runAtFile :: Parser CmdParams -> String -> FilePath -> [String] -> IO (String, Bool)
|
runAtFile :: Parser CmdParams -> String -> FilePath -> [String] -> IO (String, Bool)
|
||||||
runAtFile p s f extraparams = do
|
runAtFile p s f extraparams = do
|
||||||
|
when (null $ opts c) $
|
||||||
|
error $ "failed to find any options for " ++ f ++ " in >>>" ++ s ++ "<<<"
|
||||||
writeFile f (opts c)
|
writeFile f (opts c)
|
||||||
out <- getOutput (cmd c) (atFile f:extraparams) (env c)
|
out <- getOutput (cmd c) (atFile f:extraparams) (env c)
|
||||||
removeFile f
|
removeFile f
|
||||||
|
|
Loading…
Add table
Reference in a new issue