summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2017-09-22 13:34:39 -0400
committerDave Barach <dave@barachs.net>2017-09-22 13:39:07 -0400
commitb66201f76143391cc9b81d9c419919b9fd914a24 (patch)
treee3b5990c1c9d7e9f07b1421de3aae17c83e35ca9
parent35df2e1dc9dd639f3a28680689c1d5f3ec6d8dfc (diff)
Fix vpp "unix interactive" when running under emacs + gdb
In this specific corner-case setup, ioctl (0, TIOCGWINSZ) returns window height = 0 and width = 0. Rather than declaring the terminal to be non-interactive, set the window size parameters to 80 x 24. Change-Id: If66f5f0883f1940518ec1c6e26228c9bb6f32852 Signed-off-by: Dave Barach <dave@barachs.net>
-rw-r--r--src/vlib/unix/cli.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/vlib/unix/cli.c b/src/vlib/unix/cli.c
index ffe5de6d5b2..be3c813ae33 100644
--- a/src/vlib/unix/cli.c
+++ b/src/vlib/unix/cli.c
@@ -2776,8 +2776,14 @@ unix_cli_config (vlib_main_t * vm, unformat_input_t * input)
cf->height = ws.ws_row;
if (cf->width == 0 || cf->height == 0)
- /* We have a tty, but no size. Stick to line mode. */
- goto notty;
+ {
+ /*
+ * We have a tty, but no size. Use defaults.
+ * vpp "unix interactive" inside emacs + gdb ends up here.
+ */
+ cf->width = 80;
+ cf->height = 24;
+ }
/* Setup the history */
cf->history_limit = um->cli_history_limit;
@@ -2816,7 +2822,6 @@ unix_cli_config (vlib_main_t * vm, unformat_input_t * input)
}
else
{
- notty:
/* No tty, so make sure the session doesn't have tty-like features */
unix_cli_set_session_noninteractive (cf);
}