Skip to content

rebase -i: ignore signals when forking subprocesses #1581

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions sequencer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,7 @@ static int run_git_commit(const char *defmsg,
unsigned int flags)
{
struct child_process cmd = CHILD_PROCESS_INIT;
int res;

if ((flags & CLEANUP_MSG) && (flags & VERBATIM_MSG))
BUG("CLEANUP_MSG and VERBATIM_MSG are mutually exclusive");
Expand Down Expand Up @@ -1116,10 +1117,16 @@ static int run_git_commit(const char *defmsg,
if (!(flags & EDIT_MSG))
strvec_push(&cmd.args, "--allow-empty-message");

sigchain_push(SIGINT, SIG_IGN);
sigchain_push(SIGQUIT, SIG_IGN);
if (is_rebase_i(opts) && !(flags & EDIT_MSG))
return run_command_silent_on_success(&cmd);
res = run_command_silent_on_success(&cmd);
else
return run_command(&cmd);
res = run_command(&cmd);
sigchain_pop(SIGINT);
sigchain_pop(SIGQUIT);

return res;
}

static int rest_is_empty(const struct strbuf *sb, int start)
Expand Down Expand Up @@ -3628,10 +3635,14 @@ static int do_exec(struct repository *r, const char *command_line)
struct child_process cmd = CHILD_PROCESS_INIT;
int dirty, status;

sigchain_push(SIGINT, SIG_IGN);
sigchain_push(SIGQUIT, SIG_IGN);
fprintf(stderr, _("Executing: %s\n"), command_line);
cmd.use_shell = 1;
strvec_push(&cmd.args, command_line);
status = run_command(&cmd);
sigchain_pop(SIGINT);
sigchain_pop(SIGQUIT);

/* force re-reading of the cache */
discard_index(r->index);
Expand Down Expand Up @@ -4111,7 +4122,11 @@ static int do_merge(struct repository *r,
NULL, 0);
rollback_lock_file(&lock);

sigchain_push(SIGINT, SIG_IGN);
sigchain_push(SIGQUIT, SIG_IGN);
ret = run_command(&cmd);
sigchain_pop(SIGINT);
sigchain_pop(SIGQUIT);

/* force re-reading of the cache */
if (!ret) {
Expand Down