aboutsummaryrefslogtreecommitdiff
path: root/bb.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-09-21 13:40:35 -0700
committerBruce Hill <bruce@bruce-hill.com>2019-09-21 13:40:35 -0700
commitba7b44a3e7b5b2b240738f3c9b10cb9013a6a304 (patch)
tree335a7b4e5ed507e963798cb2cd255869614a0df3 /bb.c
parente04c9d945ccaa8bd7686d89453dc25c3642bb7fb (diff)
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)
Diffstat (limited to 'bb.c')
-rw-r--r--bb.c3
1 files changed, 3 insertions, 0 deletions
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;
}