share/config.fish: Quit if job expansion hack errors

This prevents something like `fg %5` to foreground the first job if
there is no fifth.

Fixes #9835
This commit is contained in:
Fabian Boehm
2023-06-10 15:35:44 +02:00
parent 65769bf8c8
commit 4e3b3b3b0a
2 changed files with 14 additions and 3 deletions

View File

@@ -223,18 +223,21 @@ end
for jobbltn in bg wait disown
function $jobbltn -V jobbltn
builtin $jobbltn (__fish_expand_pid_args $argv)
set -l args (__fish_expand_pid_args $argv)
and builtin $jobbltn $args
end
end
function fg
builtin fg (__fish_expand_pid_args $argv)[-1]
set -l args (__fish_expand_pid_args $argv)
and builtin fg $args[-1]
end
if command -q kill
# Only define this if something to wrap exists
# this allows a nice "commad not found" error to be triggered.
function kill
command kill (__fish_expand_pid_args $argv)
set -l args (__fish_expand_pid_args $argv)
and command kill $args
end
end