tools: sof-ri-info: use colors for terminal output only

Do not use colors if stdout is not a tty.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
This commit is contained in:
Marcin Maka 2020-05-15 17:08:57 +02:00
parent e1efef73f3
commit 4b7523c8c9
1 changed files with 5 additions and 1 deletions

View File

@ -1013,7 +1013,11 @@ class FwBin(Component):
def main(args): def main(args):
""" main function """ main function
""" """
if sys.stdout.isatty():
Attribute.no_colors = args.no_colors Attribute.no_colors = args.no_colors
else:
Attribute.no_colors = True
Attribute.full_bytes = args.full_bytes Attribute.full_bytes = args.full_bytes
fw_bin = parse_fw_bin(args.sof_ri_path, args.verbose, not args.headers) fw_bin = parse_fw_bin(args.sof_ri_path, args.verbose, not args.headers)