clickhouse-client: fix --help without tty
stdin_is_not_tty is detected too late when the --help message is printed, so fix this and do not call ioctl if stdin is not tty. Before this patch: $ clickhouse-client --help < /dev/null debug build: $ dbms/programs/clickhouse-client --help < /dev/null Main options: --help clickhouse-client: ../contrib/boost/libs/program_options/src/options_description.cpp:542: void boost::program_options::{anonymous}::format_description(std::ostream&, const string&, unsigned int, unsigned int): Assertion `line_length > first_column_width' failed. Aborted (core dumped) release build: $ dbms/programs/clickhouse-client --help < /dev/null .... print lots of empty lines and so forth ... v2: add a test and bsdutils into image for tests v3: adjust minimal cols to the length of one of the longest arguments, since with line_length=3 boost will bail anyway (under script(1) ioctl(TIOCGWINSZ) returnes ws_col=0)
Showing
想要评论请 注册 或 登录