mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-28 04:46:31 +03:00
lib: fail when file to include is in stack of 'include' files
This commit is contained in:
parent
1d91ea43a5
commit
40d70ad10b
@ -216,6 +216,10 @@ includedirectivep = do
|
||||
else parseErrorAt parserpos $ "No existing files match pattern: " ++ filename
|
||||
|
||||
parseChild parentpos filepath = do
|
||||
parentfilestack <- fmap sourceName . statePos <$> getParserState
|
||||
when (filepath `elem` parentfilestack)
|
||||
$ parseErrorAt parentpos ("Cyclic include: " ++ filepath)
|
||||
|
||||
childInput <- lift $ readFilePortably filepath
|
||||
`orRethrowIOError` (show parentpos ++ " reading " ++ filepath)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user