Separate on-job-exit and and on-process-exit events

It is possible to run a function when a process exits via `function
--on-process-exit`, or when a job exits via `function --on-job-exits`.
Internally these were distinguished by the pid in the event: if it was
positive, then it was a process exit. If negative, it represents a pgid
and is a job exit. If zero, it fires for both jobs and processes, which is
pretty weird.

Switch to tracking these explicitly. Separate out the --on-process-exit
and --on-job-exit event types into separate types. Stop negating pgids as
well.
This commit is contained in:
ridiculousfish
2021-05-19 11:29:03 -07:00
parent 406bc6a5d6
commit 504a969a24
8 changed files with 122 additions and 81 deletions

View File

@@ -28,6 +28,11 @@ function anychild --on-process-exit 0
echo $argv[1] $argv[3]
end
function anyjob --on-job-exit 0
# Type and exit status
echo $argv[1] $argv[3]
end
echo "command false:"
command false
# CHECK: command false: