Bravely set job control to full at startup

We have no idea why this was even a thing. For now simply set it to
"all"/"full" (why these two names? no idea) at startup and allow
changing it later.

Settting it *immediately* when defining the variable sets it too soon
because we don't have the interactive signal handlers
enabled (including the one for SIGTTOU), so let's first settle for
this little piece of awkwardness.

This needs widespread testing, so we merge it early, immediately after
the release.

Fixes #5036
Fixes #5832
Fixes #7721

(and probably numerous others)
This commit is contained in:
Fabian Homborg 2021-02-23 09:09:26 +01:00
parent 75a4e28e4f
commit 3255999794
2 changed files with 14 additions and 0 deletions

View file

@ -486,6 +486,9 @@ int main(int argc, char **argv) {
misc_init();
reader_init();
// And now enable "job control" for everything.
set_job_control_mode(job_control_t::all);
parser_t &parser = parser_t::principal_parser();
if (!opts.no_exec) {

View file

@ -116,3 +116,14 @@ end
emit bar
#CHECK: foo
#CHECK: caller
# Since we are in a script context, this would not trigger "job control"
# if it was set to "interactive"
status is-full-job-control
and echo is full job control
#CHECK: is full job control
# We can't rely on a *specific* pgid being assigned,
# but we can rely on it not being fish's.
command true &
set -l truepid $last_pid
test $truepid != $fish_pid || echo true has same pid as fish