File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -14,12 +14,30 @@ rm t/spec/S32-io/server-ready-flag 2>/dev/null
14
14
./perl6 t/spec/S32-io/IO-Socket-INET.pl $TEST $PORT client & CLIENT=$!
15
15
16
16
# 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
18
36
19
37
# the client should exit after about 3 seconds. The watchdog would kill
20
38
# it after 10 sec. Hang around here until the client ends, either way.
21
39
# echo BEFORE CLIENT ENDS
22
- wait $CLIENT 2> /dev/null
40
+ # wait $CLIENT 2>/dev/null
23
41
# echo AFTER CLIENT ENDED
24
42
# now that the client is finished either way, stop the server
25
43
kill $SERVER 2> /dev/null
You can’t perform that action at this time.
0 commit comments