mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 06:54:47 +08:00
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:
parent
65769bf8c8
commit
4e3b3b3b0a
|
@ -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
|
||||
|
||||
|
|
|
@ -125,3 +125,11 @@ sendline("wait 1")
|
|||
expect_prompt("wait: Could not find a job with process id '1'")
|
||||
sendline("wait hoge")
|
||||
expect_prompt("wait: Could not find child processes with the name 'hoge'")
|
||||
|
||||
# See that we don't wait if job expansion fails
|
||||
sendline("sleep 5m &")
|
||||
expect_prompt()
|
||||
sendline("wait %5")
|
||||
expect_prompt("jobs: No suitable job: %5")
|
||||
sendline("kill %1")
|
||||
expect_prompt()
|
||||
|
|
Loading…
Reference in New Issue
Block a user