commit e27ad59517b2be47404afa8dd58c9e5bf5e72848 parent d8bcfd386565ec00fdc7d6d841883f07959a7149 Author: afify <hassan@afify.dev> Date: Sun, 18 Jul 2021 15:15:12 +0300 [feat] show tb_init() failure Diffstat:
M | sfm.c | | | 14 | +++++++++++++- |
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/sfm.c b/sfm.c @@ -1770,7 +1770,19 @@ start_signal(void) static void start(void) { - FAIL_IF(tb_init() != 0, "tb_init()"); + switch (tb_init()) { + case TB_EFAILED_TO_OPEN_TTY: + die("TB_EFAILED_TO_OPEN_TTY"); + case TB_EUNSUPPORTED_TERMINAL: + die("TB_EUNSUPPORTED_TERMINAL"); + case TB_EPIPE_TRAP_ERROR: + die("TB_EUNSUPPORTED_TERMINAL"); + case 0: + break; + default: + die("UNKNOWN FAILURE"); + } + if (tb_select_output_mode(TB_OUTPUT_256) != TB_OUTPUT_256) if (tb_select_output_mode(TB_OUTPUT_NORMAL) != TB_OUTPUT_NORMAL) die("output error");