summaryrefslogtreecommitdiff
path: root/Omni/Log/Terminal.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Omni/Log/Terminal.hs')
-rw-r--r--Omni/Log/Terminal.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/Omni/Log/Terminal.hs b/Omni/Log/Terminal.hs
index 6d5d70c..a78e544 100644
--- a/Omni/Log/Terminal.hs
+++ b/Omni/Log/Terminal.hs
@@ -11,6 +11,7 @@ module Omni.Log.Terminal
where
import Alpha
+import qualified Control.Exception as Exception
import qualified Data.Text as Text
import qualified System.Console.ANSI as ANSI
import qualified System.Environment as Env
@@ -40,8 +41,8 @@ detectTerminal = do
(Nothing, _) -> False
_ -> True
- -- Get terminal size
- mSize <- ANSI.getTerminalSize
+ -- Get terminal size, catching exceptions from stdin issues
+ mSize <- Exception.catch ANSI.getTerminalSize <| \(_ :: Exception.IOException) -> pure Nothing
let (width, height) = case mSize of
Just (h, w) -> (w, h)
Nothing -> (80, 24) -- sensible default