Skip to content

Commit 3d6ab5d

Browse files
Carl Masaklizmat
authored andcommitted
kill stray IO-Socket-INET.sh process better
cono++ for patch.
1 parent 5ab54fb commit 3d6ab5d

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

S32-io/IO-Socket-INET.sh

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,30 @@ rm t/spec/S32-io/server-ready-flag 2>/dev/null
1414
./perl6 t/spec/S32-io/IO-Socket-INET.pl $TEST $PORT client & CLIENT=$!
1515

1616
# make a watchdog to kill a hanging client (occurs only if a test fails)
17-
( sleep 20; kill $CLIENT 2>/dev/null && echo '(timeout)' ) &
17+
#( sleep 20; kill $CLIENT 2>/dev/null && echo '(timeout)' ) &
18+
19+
# watchdog
20+
# the client should exit after about 3 seconds. The watchdog would kill
21+
# it after 20 sec. Hang around here until the client ends, either way.
22+
I=0
23+
while true; do
24+
# client finished
25+
kill -0 $CLIENT 2>/dev/null || break
26+
I=$(expr $I + 1)
27+
28+
# killing client if we already waiting 20 seconds
29+
if [ $I -ge 20 ]; then
30+
echo '(timeout)'
31+
kill $CLIENT 2>/dev/null
32+
break
33+
fi
34+
sleep 1
35+
done
1836

1937
# the client should exit after about 3 seconds. The watchdog would kill
2038
# it after 10 sec. Hang around here until the client ends, either way.
2139
# echo BEFORE CLIENT ENDS
22-
wait $CLIENT 2>/dev/null
40+
#wait $CLIENT 2>/dev/null
2341
# echo AFTER CLIENT ENDED
2442
# now that the client is finished either way, stop the server
2543
kill $SERVER 2>/dev/null

0 commit comments

Comments
 (0)