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 ( ...@@ -17,7 +17,7 @@ module Distribution.Client.Sandbox.Timestamp (
listModifiedDeps, listModifiedDeps,
) where ) where
import Control.Exception (finally) import Control.Exception (finally, onException)
import Control.Monad (filterM, forM, when) import Control.Monad (filterM, forM, when)
import Data.Char (isSpace) import Data.Char (isSpace)
import Data.List (partition) import Data.List (partition)
...@@ -229,17 +229,21 @@ allPackageSourceFiles verbosity packageDir = inDir (Just packageDir) $ do ...@@ -229,17 +229,21 @@ allPackageSourceFiles verbosity packageDir = inDir (Just packageDir) $ do
useCabalVersion = orLaterVersion $ Version [1,17,0] [] useCabalVersion = orLaterVersion $ Version [1,17,0] []
} }
onFailedListSources :: IO () doListSources :: IO [FilePath]
onFailedListSources = do 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 '" warn verbosity $ "Couldn't list sources of the package '"
++ display (packageName pkg) ++ "'" ++ display (packageName pkg) ++ "'"
removeExistingFile file
-- Run setup sdist --list-sources=TMPFILE -- Run setup sdist --list-sources=TMPFILE
(flip finally) (onFailedListSources) $ do (doListSources `finally` cleanupAfterListSources)
setupWrapper verbosity setupOpts (Just pkg) sdistCommand (const flags) [] `onException` onFailedListSources
srcs <- fmap lines . readFile $ file
mapM tryCanonicalizePath srcs
-- | Has this dependency been modified since we have last looked at it? -- | Has this dependency been modified since we have last looked at it?
isDepModified :: Verbosity -> EpochTime -> AddSourceTimestamp -> IO Bool 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