From 1c2c2bccbb9a863aaa0f3cdbc9b11d8e949f7eb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Janouch?= Date: Wed, 8 Apr 2015 20:43:49 +0200 Subject: [PATCH] Move a comment --- json-rpc-shell.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/json-rpc-shell.c b/json-rpc-shell.c index 9d542a2..de88e6b 100644 --- a/json-rpc-shell.c +++ b/json-rpc-shell.c @@ -2148,8 +2148,6 @@ main (int argc, char *argv[]) // the socket don't terminate the program (void) signal (SIGPIPE, SIG_IGN); - // readline 6.3 doesn't immediately redraw the terminal upon reception - // of SIGWINCH, so we must run it in an event loop to remediate that struct ev_loop *loop = EV_DEFAULT; if (!loop) exit_fatal ("libev initialization failed"); @@ -2171,10 +2169,14 @@ main (int argc, char *argv[]) ev_io_init (&tty_watcher, on_tty_readable, STDIN_FILENO, EV_READ); ev_io_start (EV_DEFAULT_ &tty_watcher); + // readline 6.3 doesn't immediately redraw the terminal upon reception + // of SIGWINCH, so we must run it in an event loop to remediate that rl_catch_sigwinch = false; g_ctx.readline_prompt_shown = true; rl_callback_handler_install (g_ctx.readline_prompt, on_readline_input); + ev_run (loop, 0); + if (g_ctx.readline_prompt_shown) rl_callback_handler_remove (); putchar ('\n');