mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 14:03:58 +00:00
Use disown with $last_pid
As mentioned in 5b706faa73
, bare
`disown` has a problem: It disowns the last *existing* job.
Unfortunately, it's easy to see cases where that won't happen:
sleep 5m &
/bin/true & # will exit immediately
disown # will most likely disown *sleep*, not true
So what we do is to pass $last_pid.
In help especially this is likely to occur because many graphical
browsers fork immediately to avoid blocking the terminal (we only
added the backgrounding and disown because some weren't).
Note that it's *possible* this doesn't occur if used in the same
function, but I don't want to rely on those semantics.
It might be worth doing this as the default - see #7210.
This commit is contained in:
parent
b489137fa9
commit
168677f8b3
2 changed files with 2 additions and 2 deletions
|
@ -94,7 +94,7 @@ function __fish_config_interactive -d "Initializations that should be performed
|
|||
# Run python directly in the background and swallow all output
|
||||
$python $update_args >/dev/null 2>&1 &
|
||||
# Then disown the job so that it continues to run in case of an early exit (#6269)
|
||||
disown >/dev/null 2>&1
|
||||
disown $last_pid >/dev/null 2>&1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -199,7 +199,7 @@ function help --description 'Show help for the fish shell'
|
|||
printf (_ 'help: Help is being displayed in %s.\n') $fish_browser[1]
|
||||
end
|
||||
$fish_browser $page_url &
|
||||
disown
|
||||
disown $last_pid >/dev/null 2>&1
|
||||
else
|
||||
# Work around lynx bug where <div class="contents"> always has the same formatting as links (unreadable)
|
||||
# by using a custom style sheet. See https://github.com/fish-shell/fish-shell/issues/4170
|
||||
|
|
Loading…
Reference in a new issue