Skip to content

Commit

Permalink
Merge pull request #202 from mitchellwrosen/master
Browse files Browse the repository at this point in the history
Don't follow symlinks in 'find'
  • Loading branch information
Gabriella439 authored Dec 18, 2016
2 parents 43a0f23 + 0fe1968 commit efc31b6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Turtle/Prelude.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1450,10 +1450,15 @@ inplace pattern file = liftIO (runManaged (do
-- | Search a directory recursively for all files matching the given `Pattern`
find :: Pattern a -> FilePath -> Shell FilePath
find pattern dir = do
path <- lstree dir
path <- lsif isNotSymlink dir
Right txt <- return (Filesystem.toText path)
_:_ <- return (match pattern txt)
return path
where
isNotSymlink :: FilePath -> IO Bool
isNotSymlink file = do
file_stat <- lstat file
return (not (PosixCompat.isSymbolicLink file_stat))

-- | A Stream of @\"y\"@s
yes :: Shell Line
Expand Down

0 comments on commit efc31b6

Please sign in to comment.