In #7207 we hypothesized that --on-process-exit may have a race. For code like so:
cmd &
function done --on-process-exit $last_pid
echo "All done"
end
does anything guarantee that cmd won't be reaped before the event handler is installed? In practice it seems to work, but we may just be getting lucky.
This tracks either making this pattern reliable (with a test), or providing something better.