Commit e2b4aa49 authored by Mikhail Glushenkov's avatar Mikhail Glushenkov
Browse files

Show the error message only if the error actually occurred.

parent 825ef1e2
......@@ -17,7 +17,7 @@ module Distribution.Client.Sandbox.Timestamp (
listModifiedDeps,
) where
import Control.Exception (finally)
import Control.Exception (finally, onException)
import Control.Monad (filterM, forM, when)
import Data.Char (isSpace)
import Data.List (partition)
......@@ -229,17 +229,21 @@ allPackageSourceFiles verbosity packageDir = inDir (Just packageDir) $ do
useCabalVersion = orLaterVersion $ Version [1,17,0] []
}
onFailedListSources :: IO ()
onFailedListSources = do
doListSources :: IO [FilePath]
doListSources = do
setupWrapper verbosity setupOpts (Just pkg) sdistCommand (const flags) []
srcs <- fmap lines . readFile $ file
mapM tryCanonicalizePath srcs
cleanupAfterListSources, onFailedListSources :: IO ()
cleanupAfterListSources = removeExistingFile file
onFailedListSources =
warn verbosity $ "Couldn't list sources of the package '"
++ display (packageName pkg) ++ "'"
removeExistingFile file
-- Run setup sdist --list-sources=TMPFILE
(flip finally) (onFailedListSources) $ do
setupWrapper verbosity setupOpts (Just pkg) sdistCommand (const flags) []
srcs <- fmap lines . readFile $ file
mapM tryCanonicalizePath srcs
(doListSources `finally` cleanupAfterListSources)
`onException` onFailedListSources
-- | Has this dependency been modified since we have last looked at it?
isDepModified :: Verbosity -> EpochTime -> AddSourceTimestamp -> IO Bool
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment