> function test_jobs; end;
> cat | test_jobs &
fish: Job 1, 'cat | test_jobs &' has stopped
> jobs
Job Group CPU State Command
1 77562 0% stopped cat | test_jobs &
> fg %1
fg: No suitable job: 0
> jobs -p %1
77562
0
The problem is that __fish_expand_pid_args returns pids 77625 and the invalid/incorrect 0 for the one job that is running (in that order), and the fg function forwards only the last value to the actual fg command (fg $args[-1]).
jobs -p 0 naturally fails with jobs: No suitable job: 0
We can hack around this by filtering out 0 in __fish_expand_pid_args, but we might want to stop emitting 0 altogether in jobs -p.
The problem is that
__fish_expand_pid_argsreturns pids77625and the invalid/incorrect0for the one job that is running (in that order), and thefgfunction forwards only the last value to the actualfgcommand (fg $args[-1]).jobs -p 0naturally fails withjobs: No suitable job: 0We can hack around this by filtering out
0in__fish_expand_pid_args, but we might want to stop emitting0altogether injobs -p.