Description:
The -e option to mysql turns on batch-mode, which make --tee and --pager stop working. E.g. --tee work when run interactively.
Having --tee and --pager work also when run not-interactively is good for scripting purposes.
How to repeat:
$ ../client/mysql -S var/tmp/mysqld.1.sock -u root --tee=./file.txt performance_schema
Logging to file './file.txt'
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 6.0.11-alpha-debug-log-perfschema Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> \q
Bye
$ ../client/mysql -S var/tmp/mysqld.1.sock -u root --tee=./file.txt performance_schema
$ cat file.txt
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 6.0.11-alpha-debug-log-perfschema Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> \q
$ rm file.txt
$ ../client/mysql -S var/tmp/mysqld.1.sock -u root -e "SHOW TABLES" --tee=./file.txt performance_schema
Logging to file './file.txt'
+----------------------------------------------+
| Tables_in_performance_schema |
+----------------------------------------------+
| COND_INSTANCES |
| EVENTS_WAITS_CURRENT |
| EVENTS_WAITS_HISTORY |
| EVENTS_WAITS_HISTORY_LONG |
| EVENTS_WAITS_SUMMARY_BY_EVENT_NAME |
| EVENTS_WAITS_SUMMARY_BY_INSTANCE |
| EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME |
| FILE_INSTANCES |
| FILE_SUMMARY_BY_EVENT_NAME |
| FILE_SUMMARY_BY_INSTANCE |
| MUTEX_INSTANCES |
| PERFORMANCE_TIMERS |
| PROCESSLIST |
| RWLOCK_INSTANCES |
| SETUP_CONSUMERS |
| SETUP_INSTRUMENTS |
| SETUP_OBJECTS |
| SETUP_TIMERS |
+----------------------------------------------+
$ cat file.txt
$
Also: cat'ing something to mysql client make --tee not work.
$ cat /tmp/agent.sql | ./mysql -h machine -P 56500 -u admin --password=... --tee=/tmp/test.log
Logging to file '/tmp/test.log'
Site Port Local Hosts
mysite 56500 Local nanna11
[ /opt/csw/mysql5/bin ]
$ cat /tmp/test.log
$
Suggested fix:
Stop disabling of pager and outfile in batch mode.