Skip to content

If job expansion fails, builtins and kill still run #9835

@faho

Description

@faho

If a %n expansion fails, the builtins that support it via the __fish_expand_pid_args hack still run, but typically with the first job instead:

> sleep 50 &
> fg %2 # no second job exists
jobs: No suitable job: %2
Send job 1 (sleep 50 &) to foreground

same with wait, bg and kill - in the latter case it's a bit worse because kill 1 %4 5 will run kill 1, because __fish_expand_pid_args quits at the second argument.

This is easily fixable by doing set -l args (__fish_expand_pid_args); or return in all these.

To be honest I would just add %n job expansion to the remaining builtins (and I don't think a kill builtin would be the worst thing in the world).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions