fix reversion in display of fatal exceptions

fdac66ae10 lost the "git-annex:" prefix,
which broke datalad's parsing of an error message (ugh)

Also, don't use warningIO because it displays a blank line to stdout,
which is also a behavior change from before, and does not seem
necessary.

Sponsored-by: Brock Spratlen on Patreon
This commit is contained in:
Joey Hess 2023-05-01 12:25:14 -04:00
parent 0bf983d3ab
commit e0dde88797
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -60,6 +60,7 @@ import qualified Data.ByteString as S
import qualified Data.ByteString.Char8 as S8
import System.Exit
import qualified Control.Monad.Catch as M
import Data.String
import Common
import Types
@ -200,8 +201,8 @@ endResult :: Bool -> S.ByteString
endResult True = "ok"
endResult False = "failed"
toplevelMsg :: StringContainingQuotedPath -> StringContainingQuotedPath
toplevelMsg = ("git-annex: " <>)
toplevelMsg :: (Semigroup t, IsString t) => t -> t
toplevelMsg s = fromString "git-annex: " <> s
toplevelFileProblem :: Bool -> MessageId -> StringContainingQuotedPath -> String -> RawFilePath -> Maybe Key -> SeekInput -> Annex ()
toplevelFileProblem makeway messageid msg action file mkey si = do
@ -353,5 +354,5 @@ sanitizeTopLevelExceptionMessages a = a `catches`
((M.Handler (\ (e :: ExitCode) -> throwM e)) : nonAsyncHandler go)
where
go e = do
warningIO (show e)
hPutStrLn stderr $ safeOutput $ toplevelMsg (show e)
exitWith $ ExitFailure 1