[MDEV-20223] Add colors to mtr in case of STDIN Created: 2019-07-31  Updated: 2019-08-07  Resolved: 2019-08-06

Status: Closed
Project: MariaDB Server
Component/s: Server, Tests
Affects Version/s: None
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Anel Husakovic Assignee: Sergei Golubchik
Resolution: Won't Fix Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-19531 Add colors to mtr Closed

 Description   

mtr got colors in MDEV-19531.
When we do ./mtr main.ps | tee "tmp" there is no color

==============================================================================
 
TEST                                      RESULT   TIME (ms) or COMMENT
--------------------------------------------------------------------------
 
worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
main.ps                                  [ pass ]   1151

but there should be.



 Comments   
Comment by Sergei Golubchik [ 2019-08-06 ]

mtr intentionally disables colors if the output is not a terminal. because — exactly — you don't want ANSI escape sequences in your "tmp" file.

There are two solutions for that

  • if you want colors and do not want ANSI escape sequences in the log — do not do anything. Run ./mtr main.ps with no further options, the clean log will be in var/log/stdout.log
  • if you, for some reason, want the log with ANSI escape sequences, run script -c "./mtr main.ps"
Comment by Anel Husakovic [ 2019-08-07 ]

Thank you serg for clarification.

Generated at Thu Feb 08 08:57:48 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.