Simplify maybe_assign_terminal()

Move this out of postfork, it is not called after fork.
This commit is contained in:
ridiculousfish
2019-06-29 14:30:43 -07:00
parent f58960ba01
commit 98ba7d7790
3 changed files with 7 additions and 19 deletions

View File

@@ -117,6 +117,13 @@ char *get_interpreter(const char *command, char *interpreter, size_t buff_size)
return NULL;
}
/// Assign the terminal to a job.
static void maybe_assign_terminal(const job_t *j) {
if (j->wants_terminal() && j->is_foreground()) {
terminal_give_to_job(j, false /*new job, so not continuing*/);
}
}
/// This function is executed by the child process created by a call to fork(). It should be called
/// after \c child_setup_process. It calls execve to replace the fish process image with the command
/// specified in \c p. It never returns. Called in a forked child! Do not allocate memory, etc.