MessageState,
prompt,
mkPrompter,
+ sanitizeTopLevelExceptionMessages,
) where
import Control.Concurrent
import Control.Monad.IO.Class
import qualified Data.ByteString as S
import qualified Data.ByteString.Char8 as S8
+import System.Exit
import Common
import Types
(takeMVar l)
(\v -> putMVar l v >> cleanup)
(const $ run a)
+
+{- Catch all (non-async) exceptions and display, santizing any control
+ - characters in the exceptions. Exits nonzero on exception, so should only
+ - be used at topmost level. -}
+sanitizeTopLevelExceptionMessages :: IO a -> IO a
+sanitizeTopLevelExceptionMessages a = catchNonAsync a go
+ where
+ go e = do
+ warningIO (show e)
+ exitWith $ ExitFailure 1
other exceptions, including ones thrown by libraries. Catch all exceptions
at top-level (of program and/or worker threads) and filter out control
characters?
+
+> Fixed with a top-level exception catcher; assuming all worker threads
+> have something waiting on them that displays or propagates their
+> exceptions.
+
+----
+
+> all [[fixed|done]]! --[[Joey]]
import qualified CmdLine.GitRemoteTorAnnex
import qualified Test
import qualified Benchmark
+import Messages
import Utility.FileSystemEncoding
#ifdef mingw32_HOST_OS
#endif
main :: IO ()
-main = withSocketsDo $ do
+main = sanitizeTopLevelExceptionMessages $ withSocketsDo $ do
useFileSystemEncoding
ps <- getArgs
#ifdef mingw32_HOST_OS