Fix display on "dumb" terminals
Problem: brew does not respect "dumb" terminals. When running brew from a dumb terminal, I have the following display: % brew reinstall caffeine ==> Fetching downloads for: caffeine ⠋ Cask caffeine (1.1.4) Downloading 827.6KB/-------⠋ Cask caffeine (1.1.4) Downloading 827.6KB/-------⠙ Cask caffeine (1.1.4) Downloading 827.6KB/-------⠙ Cask caffeine (1.1.4) Downloading 827.6KB/-------⠚ Cask caffeine (1.1.4) Downloading 827.6KB/-------⠚ Cask caffeine (1.1.4) Downloading 827.6KB/-------⠞ Cask caffeine (1.1.4) Downloading 827.6KB/-------⠞ Cask caffeine (1.1.4) Downloading 827.6KB/-------⠖ Cask caffeine (1.1.4) Downloading 827.6K [...] From man term(7): Older UNIX systems pre‐set a very dumb terminal type like ‘dumb’ or ‘di‐ alup’ on dialup lines. Newer ones may pre‐set ‘vt100’, reflecting the prevalence of DEC VT100‐compatible terminals and personal‐computer emula‐ tors. Those "dumb" terminals is are still useful nowadays. For instance, they are the default value in Emacs shell or eshell. In those terminals, we cannot use the ANSI escape sequences to move the cursor around (but I guess, today all dumb terminals supports ANSI colors escape sequences). Solution: Detect whether brew is run from a dumb terminal and stop displaying progress in that case. The result is: % bin/brew reinstall caffeine ==> Fetching downloads for: caffeine ✔︎ Cask caffeine (1.1.4) ==> Uninstalling Cask caffeine We only display the final status (green tick or red cross) since nowadays dumb terminals seem to understand the color control sequences.
L
Laurent Stacul committed
f20c2621c302d46b9ef70dc38d79c332c228aff7
Parent: 663077f