on master help sign in
Merge pull request #109 from matthewbauer/respect-dumb-term

Check for TERM=dumb when enabling spinner

commit5390ef2a8a924108c5d9c652d1a3f7201862d1ed authorRyan Trinkle <ryan.trinkle@gmail.com> dateTue 4 Sep 2018, 11:09 (8 years ago) parentbeb5dee2bd92d0
1 file changed+8−1
lib/command/src/Obelisk/Command.hs+8−1
lib/command/src/Obelisk/Command.hs+8−1
@@ -274,7 +274,14 @@ mkObeliskConfig = do
274274 isTerm <- hIsTerminalDevice stdout
275275 -- Running in bash/fish/zsh completion
276276 inShellCompletion <- liftIO $ isInfixOf "completion" . unwords <$> getArgs
277− return $ isTerm && not inShellCompletion
277+
278+ -- Respect the user’s TERM environment variable. Dumb terminals
279+ -- like Eshell cannot handle lots of control sequences that the
280+ -- spinner uses.
281+ termEnv <- lookupEnv "TERM"
282+ let isDumb = termEnv == Just "dumb"
283+
284+ return $ isTerm && not inShellCompletion && not isDumb
278285
279286-- | For use from development obelisk repls
280287--