diff --git a/CmdLine.hs b/CmdLine.hs index 85423e5e89..46b980fbcb 100644 --- a/CmdLine.hs +++ b/CmdLine.hs @@ -87,7 +87,9 @@ tryRun' state errnum (a:as) = do a case result of Left err -> do - Annex.eval state $ showErr err + Annex.eval state $ do + showEndFail + showErr err tryRun' state (errnum + 1) as Right (True,state') -> tryRun' state' errnum as Right (False,state') -> tryRun' state' (errnum + 1) as diff --git a/Command.hs b/Command.hs index d36f675d24..c666ddbd29 100644 --- a/Command.hs +++ b/Command.hs @@ -96,10 +96,15 @@ prepCommand Command { cmdseek = seek } params = do doCommand :: CommandStart -> CommandCleanup doCommand = start where - start = stage $ maybe (return True) perform - perform = stage $ maybe (showEndFail >> return False) cleanup + start = stage $ maybe success perform + perform = stage $ maybe failure cleanup cleanup = stage $ \r -> showEndResult r >> return r stage a b = b >>= a + success = return True + failure = do + showProgress + showEndFail + return False notAnnexed :: FilePath -> Annex (Maybe a) -> Annex (Maybe a) notAnnexed file a = maybe a (const $ return Nothing) =<< Backend.lookupFile file diff --git a/Command/Map.hs b/Command/Map.hs index 7bb435ff81..940db54c89 100644 --- a/Command/Map.hs +++ b/Command/Map.hs @@ -175,6 +175,7 @@ scan r = do showEndOk return r' Nothing -> do + showProgress showEndFail return r diff --git a/Messages.hs b/Messages.hs index c44e44eea1..038e4c0bc7 100644 --- a/Messages.hs +++ b/Messages.hs @@ -43,14 +43,16 @@ showEndOk :: Annex () showEndOk = verbose $ liftIO $ putStrLn "ok" showEndFail :: Annex () -showEndFail = verbose $ liftIO $ putStrLn "\nfailed" +showEndFail = verbose $ liftIO $ putStrLn "failed" showEndResult :: Bool -> Annex () showEndResult True = showEndOk showEndResult False = showEndFail showErr :: (Show a) => a -> Annex () -showErr e = warning $ "git-annex: " ++ show e +showErr e = do + liftIO $ hFlush stdout + liftIO $ hPutStrLn stderr $ "git-annex: " ++ show e warning :: String -> Annex () warning w = do