sway
sway copied to clipboard
Forc: colored output to go only to a tty
If you redirect the stdout/stderr from Forc to something other than a tty you're still going to have ANSI escape codes for coloring:
❯ forc build |& cat --show-all
^[[0m^[[32m Compiled library "core".$
^[[0m^[[0m^[[32m Compiled library "std".$
^[[0m^[[0m^[[32m Compiled contract "transaction_block_height".$
^[[0m Bytecode size is 84 bytes.$
The convention for CLI tools is to check (via isatty) if what you're writing to is a tty before using escape codes.
Cargo also provides a --color flag for controlling this, we might want to consider doing something similar too.
We should consider addressing #2373 first as it would simplify adding an isatty check.