Call tcsetgrp() in child processes again

25afc9b377 made this unnecessary by
having child processes wait for a signal after fork(), but this change
was later reverted. If we artificially slow down fish (e.g. with a sleep)
after the fork call, we see commands getting backgrounded by mistake.

Put back the tcsetgrp() call.
This commit is contained in:
ridiculousfish
2019-06-22 12:33:06 -07:00
parent 8255c01edb
commit 5362161343
3 changed files with 15 additions and 6 deletions

View File

@@ -300,7 +300,7 @@ void internal_exec(env_stack_t &vars, job_t *j, const io_chain_t &all_ios) {
// commands in the pipeline will apply to exec. However, using exec in a pipeline doesn't
// really make sense, so I'm not trying to fix it here.
auto redirs = dup2_list_t::resolve_chain(all_ios);
if (redirs && !child_setup_process(0, *redirs)) {
if (redirs && !child_setup_process(nullptr, nullptr, *redirs)) {
// Decrement SHLVL as we're removing ourselves from the shell "stack".
auto shlvl_var = vars.get(L"SHLVL", ENV_GLOBAL | ENV_EXPORT);
wcstring shlvl_str = L"0";
@@ -445,7 +445,7 @@ static bool fork_child_for_process(const std::shared_ptr<job_t> &job, process_t
// stdout and stderr, and then exit.
p->pid = getpid();
child_set_group(job.get(), p);
child_setup_process(p, dup2s);
child_setup_process(job.get(), p, dup2s);
child_action();
DIE("Child process returned control to fork_child lambda!");
}