Skip to content

Commit fe35860

Browse files
dashaxiongbmw
authored andcommitted
Add cleanup trap to integration test script (certbot#4075)
The integration test script spins up Python webservers. This trap will ensure that those webservers are shutdown at exit.
1 parent ea95115 commit fe35860

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/boulder-integration.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ else
2020
readlink="readlink"
2121
fi
2222

23+
cleanup_and_exit() {
24+
EXIT_STATUS=$?
25+
if SERVER_STILL_RUNNING=`ps -p $python_server_pid -o pid=`
26+
then
27+
echo Kill server subprocess, left running by abnormal exit
28+
kill $SERVER_STILL_RUNNING
29+
fi
30+
exit $EXIT_STATUS
31+
}
32+
33+
trap cleanup_and_exit EXIT
34+
2335
common_no_force_renew() {
2436
certbot_test_no_force_renew \
2537
--authenticator standalone \

0 commit comments

Comments
 (0)