This moves us slightly closer towards fish code in the background. The idea is
that a background job may still have "foreground" sub-jobs, example:
begin ; sleep 5 ; end &
The begin/end job runs in the background but should wait for `sleep`.
Prior to this fix, fish would see the overall job group is in the background
and not wait for any of its processes. With this change we detach waiting from
is_foreground.
This changes how fish attempts to protect itself from calling tcsetpgrp() too
aggressively. Recall that tcsetpgrp() will "force" itself, if SIGTTOU is
ignored (which it is in fish when job control is enabled).
Prior to this fix, we avoided SIGTTINs by only transferring the tty ownership
if fish was already the owner. This dated from a time before we had really
nailed down how pgroups should be assigned. Now we more deliberately assign a
job's pgroup so we don't need this conservative check.
However we still need logic to avoid transferring the tty if fish is not the
owner. The bad case is when job control is enabled while fish is running in the
background - here fish would transfer the tty and "steal" from the foreground
process.
So retain the checks of the current tty owner but migrate them to the point of
calling tcsetpgrp() itself.
add_disowned_pgid skipped jobs that have a PGID equal to the running
process. However, this includes processes started in config.fish or when
job control is turned off, so they never get waited on.
Instead, refactor this function to add_disowned_job, and add either the PGID or
all the PIDs of the job to the list of disowned PIDs/PGIDs.
Fixes#7183.
This is a set of miscellaneous cleanup for profiling.
An errant newline has been removed from 'if' statement output, which got
introduced with the new ast.
Switch from storing unique_ptr to a deque, which allocates less.
Collapse "parse" and "exec" times into just a single value "duration". The
"parse" time no longer makes sense, as we now parse ahead of time.
pacman -U is intended to be used with (among others) files like this:
# pacman -U ./linux-headers-5.6.2.arch1-2-x86_64.pkg.tar.zst
Thus, let's enable file path completion for this kind of operation.
One of the nicest things about fish is how introspectable it is. We
should probably get people to just mess around and see what is
implemented how. This is a step in that direction.
[ci skip]
If it can't recognize the DE, xdg-open uses a "generic" way of opening
things where it doesn't spawn off a DE-provided utility like kde-open.
This sounds great, but it fails to fork and therefore blocks the
terminal.
So we start it in the background and disown it.
Fixes#7215.
The prefix has already been case-corrected at this point and the remaining
completions are for the suffix only.
Fixes#7211
Introduced in
28d67c8f Show completion list on Tab also if a common prefix was inserted
These are events that have been queued but not yet fired. There's no
reason to modify the events after creating them. Mark them as const
to ensure that doesn't happen.
Assigning the tty is really a function of a job group, not an individual
job. Reflect that in terminal_maybe_give_to_job_group and also
terminal_return_from_job_group.
- add missing links for some commands (control flow section)
- fix broken links that use the old syntax (#tut_ links)
- miscellaneous fixing of backticks/emphasis
In practice this means that, if fish ever gets multiple variable stacks,
we will only incorporate environment variable changes from other fish
instances on the "main thread."