diff --git a/dbms/src/Server/Client.cpp b/dbms/src/Server/Client.cpp index 1e13222781c..4f39cf2a9ee 100644 --- a/dbms/src/Server/Client.cpp +++ b/dbms/src/Server/Client.cpp @@ -957,6 +957,7 @@ private: String pager = config().getString("pager", ""); if (!pager.empty()) { + signal(SIGPIPE, SIG_IGN); pager_cmd = ShellCommand::execute(pager, true); out_buf = &pager_cmd->in; } diff --git a/dbms/tests/queries/0_stateless/00532_pager_sigpipe.reference b/dbms/tests/queries/0_stateless/00532_pager_sigpipe.reference new file mode 100644 index 00000000000..7326d960397 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00532_pager_sigpipe.reference @@ -0,0 +1 @@ +Ok diff --git a/dbms/tests/queries/0_stateless/00532_pager_sigpipe.sh b/dbms/tests/queries/0_stateless/00532_pager_sigpipe.sh new file mode 100755 index 00000000000..beca7e68a97 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00532_pager_sigpipe.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) + +expect $CURDIR/00532_pager_sigpipe.tcl && echo 'Ok' || echo 'Fail' diff --git a/dbms/tests/queries/0_stateless/00532_pager_sigpipe.tcl b/dbms/tests/queries/0_stateless/00532_pager_sigpipe.tcl new file mode 100644 index 00000000000..dcdff6bf179 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00532_pager_sigpipe.tcl @@ -0,0 +1,15 @@ +set timeout -1 + +log_user 0 + +spawn clickhouse-client --pager=head + +expect ":) " + +send "select name from system.settings union all select name from system.settings union all select name from system.settings union all select name from system.settings union all select name from system.settings union all select name from system.settings union all select name from system.settings union all select name from system.settings\r" + +expect ":) " + +send "quit\r" + +expect eof