Commit 56515968 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Exit(2) if we get a CLI timeout.

parent 1d166a9b
......@@ -174,8 +174,10 @@ pass_answer(int fd, enum pass_mode_e mode)
u = VCLI_ReadResult(fd, &status, &answer, timeout);
if (u) {
if (status == CLIS_COMMS)
RL_EXIT(0);
if (status == CLIS_COMMS) {
fprintf(stderr, "%s\n", answer);
RL_EXIT(2);
}
if (answer)
fprintf(stderr, "%s\n", answer);
RL_EXIT(1);
......@@ -304,6 +306,7 @@ interactive(int sock)
{
struct pollfd fds[2];
int i;
unsigned status;
line_sock = sock;
rl_already_prompted = 1;
rl_callback_handler_install("varnish> ", send_line);
......@@ -324,8 +327,10 @@ interactive(int sock)
if (fds[0].revents & POLLIN) {
/* Get rid of the prompt, kinda hackish */
printf("\r \r");
(void)pass_answer(fds[0].fd, pass_interactive);
status = pass_answer(fds[0].fd, pass_interactive);
rl_forced_update_display();
if (status == CLIS_CLOSE)
RL_EXIT(0);
}
if (fds[1].revents & POLLIN) {
rl_callback_read_char();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment