on master help sign in
Check for TERM=dumb when enabling spinner

The spinner uses a lot of characters that can break things in some dumb terminal.

commit2bd92d065de57b82ccd253b2f1127dbe7a346ce8 authorMatthew Bauer <mjbauer95@gmail.com> dateThu 5 Jul 2018, 15:19 (8 years ago) parent64e0fca
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--