vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit ccd6045ec00d489600b0635cf366bba841de64b0
parent ba3b0f4eb8f3c0ee6cddc8e164fb1841225771d6
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Sun, 15 Apr 2018 12:16:55 +0200

ui: make sure $TERM is set

libtermkey passes the $TERM value unchecked to libunibilium which just
aborts (in debug builds) or crashes (in release builds). Workaround
that by defaulting to `xterm`, if $TERM is unset. It should eventually
be fixed in libtermkey/unibilium too.

This fixes test suite failures on the Debian package build environment.
It might also be the reason for failures in other CI environments
e.g.: https://github.com/alpinelinux/aports/pull/3768

Diffstat:
Mui-terminal.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ui-terminal.c b/ui-terminal.c @@ -644,8 +644,10 @@ static bool ui_init(Ui *ui, Vis *vis) { setlocale(LC_CTYPE, ""); char *term = getenv("TERM"); - if (!term) + if (!term) { term = "xterm"; + setenv("TERM", term, 1); + } errno = 0; if (!(tui->termkey = ui_termkey_new(STDIN_FILENO))) {