From ba7b44a3e7b5b2b240738f3c9b10cb9013a6a304 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 21 Sep 2019 13:40:35 -0700 Subject: Fix for broken behavior in the help menu (hanging when reaching the end, due to not close()ing the file descriptor, and exiting on ctrl-c) --- bb.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'bb.c') diff --git a/bb.c b/bb.c index 88add91..4322301 100644 --- a/bb.c +++ b/bb.c @@ -1044,9 +1044,11 @@ bb_result_t process_cmd(bb_t *bb, const char *cmd) int fds[2]; pipe(fds); pid_t child = fork(); + void (*old_handler)(int) = signal(SIGINT, SIG_IGN); if (child != 0) { close(fds[0]); print_bindings(fds[1]); + close(fds[1]); waitpid(child, NULL, 0); } else { close(fds[1]); @@ -1055,6 +1057,7 @@ bb_result_t process_cmd(bb_t *bb, const char *cmd) execvp("sh", args); } init_term(); + signal(SIGINT, old_handler); bb->dirty = 1; return BB_OK; } -- cgit v1.2.3