disown: add tests for disowned jobs in scripts

This commit is contained in:
David Adam 2020-07-14 20:34:47 +08:00 committed by Mahmoud Al-Qudsi
parent 2720f3d2ef
commit 2c5d4937e3

View File

@ -1,4 +1,19 @@
#RUN: %fish %s
# Verify zombies are not left by disown (#7183, #5342)
# Do this first to avoid colliding with the other disowned processes below, which may
# still be running at the end of the script
sleep 0.2 &
disown
sleep 0.2
echo Trigger process reaping
#CHECK: Trigger process reaping
# The initial approach here was to kill the PID of the sleep process, which should
# be gone by the time we get here. Unfortunately, kill from procps on pre-2016 distributions
# does not print an error for non-existent PIDs, so instead look for zombies in this session
# (there should be none).
ps -o state | string match 'Z*'
jobs -q
echo $status
#CHECK: 1