Bug 15940

Summary: jobs omits the last job when run from a subshell
Product: Busybox Reporter: cheery.hope5461
Component: OtherAssignee: unassigned
Status: NEW ---    
Severity: normal CC: busybox-cvs
Priority: P5    
Version: 1.36.x   
Target Milestone: ---   
Hardware: Macintosh   
OS: Linux   
Host: Target:
Build:

Description cheery.hope5461 2024-02-07 01:22:22 UTC
Test (to be run from an interactive shell):

vim &
vim &
echo no subshell
jobs
echo subshell
j="$(jobs)"
echo "$j"

Output:

[1] 10523
[2] 10524
no subshell
[1]  - running    vim
[2]  + running    vim
subshell
[1]  - running    vim

Expected output:

[1] 10523
[2] 10524
no subshell
[1]  - running    vim
[2]  + running    vim
subshell
[1]  - running    vim
[2]  + running    vim # <- this is missing when jobs is run from a subshell