From 325599979479ae04ebac1d0556519f973058993e Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Tue, 23 Feb 2021 09:09:26 +0100 Subject: [PATCH] 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) --- src/fish.cpp | 3 +++ tests/checks/jobs.fish | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/fish.cpp b/src/fish.cpp index 719777d65..53063e0e5 100644 --- a/src/fish.cpp +++ b/src/fish.cpp @@ -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) { diff --git a/tests/checks/jobs.fish b/tests/checks/jobs.fish index 9f88a7c3a..1df6e7afd 100644 --- a/tests/checks/jobs.fish +++ b/tests/checks/jobs.fish @@ -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