ClickHouse/dbms/tests/queries/0_stateless/helpers/client.py
Vitaliy Zakaznikov 280025d5b4 * Updating live view tests to workaround an issue with clickhouse-client exiting when
Ctrl-C is pressed during WATCH query execution instead of going to the
  client prompt.
2019-07-10 08:22:31 -04:00

24 lines
578 B
Python

import os
import sys
CURDIR = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.join(CURDIR))
import uexpect
prompt = ':\) '
end_of_block = r'.*\r\n.*\r\n'
def client(command=None, name='', log=None):
client = uexpect.spawn(['/bin/bash','--noediting'])
if command is None:
command = os.environ.get('CLICKHOUSE_BINARY', 'clickhouse') + '-client'
client.command = command
client.eol('\r')
client.logger(log, prefix=name)
client.timeout(20)
client.expect('[#\$] ', timeout=2)
client.send(command)
return client