mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-17 11:01:14 -03:00
child_setup_process to accept new termowner directly
Soon we will have more complicated logic around whether to call tcsetpgrp. Prepare to centralize the logic by passing in the new term owner pgrp, instead of having child_setup_process perform the decision.
This commit is contained in:
@@ -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(nullptr, false, *redirs)) {
|
||||
if (redirs && !child_setup_process(INVALID_PID, false, *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";
|
||||
@@ -443,9 +443,11 @@ static bool fork_child_for_process(const std::shared_ptr<job_t> &job, process_t
|
||||
if (pid == 0) {
|
||||
// This is the child process. Setup redirections, print correct output to
|
||||
// stdout and stderr, and then exit.
|
||||
maybe_t<pid_t> new_termowner{};
|
||||
p->pid = getpid();
|
||||
child_set_group(job.get(), p);
|
||||
child_setup_process(job.get(), true, dup2s);
|
||||
child_setup_process(job->wants_terminal() && job->is_foreground() ? job->pgid : INVALID_PID,
|
||||
true, dup2s);
|
||||
child_action();
|
||||
DIE("Child process returned control to fork_child lambda!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user