1
0

Compare commits

..

2 Commits

Author SHA1 Message Date
b9b8599169 Made test output more readable. 2020-05-27 13:24:03 -07:00
8fef80ddad Add solution using while kill %%. 2020-05-27 13:20:17 -07:00
3 changed files with 11 additions and 4 deletions

6
bash.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
kill_child_jobs() {
# From https://stackoverflow.com/a/360275
while kill %% 2>/dev/null; do sleep 0; done
}

View File

@ -9,6 +9,7 @@ echo " ∞=script does not halt (after 1 second timeout)"
echo " X=disown unsupported by shell"
echo " ☠=all children killed"
echo " 🏃=all children still running"
echo " ✔️=expected result (job killed, disowned child alive)"
echo
printf '\t'

View File

@ -49,23 +49,23 @@ sleep 0.1s
if grep -q '^shell does not support disown$' "$TMP"
then
printf "X"
printf 'X'
fi
if ! grep -q '^disowned outlived parent.$' "$TMP"
then
# disowned should have outlived parent
EXITCODE=2
printf "☠"
printf '☠'
elif grep -q '^job outlived parent.$' "$TMP"
then
# job should not outlive parent
EXITCODE=3
printf "🏃"
printf '🏃'
else
# all good
EXITCODE=0
printf '%s' "$SHELL"
printf '✔️'
fi
rm -f "$TMP"