From aabc498fdb7bb0db8b59505d64b548c7e38d91ec Mon Sep 17 00:00:00 2001 From: Lennart Spitzner Date: Wed, 9 Feb 2022 21:35:49 +0000 Subject: [PATCH] Stop handling exception that we do not expect Now that we guard via hSupportsANSI this is not an exception that should occur. And if it occurs we'd rather crash, as reading of stdin can be broken after such an exception. --- src-hxbrief/Main.hs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src-hxbrief/Main.hs b/src-hxbrief/Main.hs index 5324066..d8498be 100644 --- a/src-hxbrief/Main.hs +++ b/src-hxbrief/Main.hs @@ -452,10 +452,7 @@ main = B.mainFromCmdParser $ do termWidthMay <- restore $ do support <- Ansi.hSupportsANSI System.IO.stdin if support - then try Ansi.getTerminalSize <&> \case - Left (_e :: IOException) -> Nothing - Right Nothing -> Nothing - Right (Just (_, w)) -> Just w + then fmap snd <$> Ansi.getTerminalSize else pure Nothing let stdoutCheckCount = length