Skip to content

Commit 4eb4650

Browse files
committed
Don't fail if library directory not present #371
1 parent b1fa05f commit 4eb4650

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Stack/PackageDump.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ module Stack.PackageDump
2525
) where
2626

2727
import Control.Applicative
28+
import Control.Exception.Enclosed (tryIO)
2829
import Control.Monad (when, liftM)
2930
import Control.Monad.Catch
3031
import Control.Monad.IO.Class
@@ -189,11 +190,12 @@ addProfiling (InstalledCache ref) =
189190
Nothing -> do
190191
let loop [] = return False
191192
loop (dir:dirs) = do
192-
contents <- getDirectoryContents $ S8.unpack dir
193+
econtents <- tryIO $ getDirectoryContents $ S8.unpack dir
194+
let contents = either (const []) id econtents
193195
if or [isProfiling content lib
194196
| content <- contents
195197
, lib <- dpLibraries dp
196-
]
198+
] && not (null contents)
197199
then return True
198200
else loop dirs
199201
loop $ dpLibDirs dp

0 commit comments

Comments
 (0)