Skip to content

Commit cb1613a

Browse files
committed
Fixed TUI and temporarily ignore SIGINT during subdialog execution.
Closes #2584
1 parent 52bd094 commit cb1613a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/goaccess.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,14 @@ get_keys (Logs *logs) {
10151015
int c, quit = 1;
10161016
uint32_t offset = 0;
10171017

1018+
struct sigaction act, oldact;
1019+
1020+
/* Change the action for SIGINT to SIG_IGN and block Ctrl+c
1021+
* before entering the subdialog */
1022+
act.sa_handler = SIG_IGN;
1023+
sigemptyset (&act.sa_mask);
1024+
act.sa_flags = 0;
1025+
10181026
while (quit) {
10191027
if (conf.stop_processing)
10201028
break;
@@ -1033,7 +1041,9 @@ get_keys (Logs *logs) {
10331041
case KEY_F (1):
10341042
case '?':
10351043
case 'h':
1044+
sigaction (SIGINT, &act, &oldact);
10361045
load_help_popup (main_win);
1046+
sigaction (SIGINT, &oldact, NULL);
10371047
render_screens (offset);
10381048
break;
10391049
case 49: /* 1 */
@@ -1204,20 +1214,29 @@ get_keys (Logs *logs) {
12041214
render_screens (offset);
12051215
break;
12061216
case '/':
1217+
sigaction (SIGINT, &act, &oldact);
12071218
if (render_search_dialog (search) == 0)
12081219
render_screens (offset);
1220+
sigaction (SIGINT, &oldact, NULL);
12091221
break;
12101222
case 99: /* c */
12111223
if (conf.no_color)
12121224
break;
1225+
1226+
sigaction (SIGINT, &act, &oldact);
12131227
load_schemes_win (main_win);
1228+
sigaction (SIGINT, &oldact, NULL);
1229+
12141230
free_dashboard (dash);
12151231
allocate_data ();
12161232
set_wbkgd (main_win, header_win);
12171233
render_screens (offset);
12181234
break;
12191235
case 115: /* s */
1236+
sigaction (SIGINT, &act, &oldact);
12201237
render_sort_dialog ();
1238+
sigaction (SIGINT, &oldact, NULL);
1239+
12211240
render_screens (offset);
12221241
break;
12231242
case 269:

0 commit comments

Comments
 (0)