Support Ctrl-C/SIG INT stopping Prowler when running in Docker @marcjay

Support Ctrl-C/SIG INT stopping Prowler when running in Docker
This commit is contained in:
Toni de la Fuente
2020-05-21 18:08:00 +02:00
committed by GitHub

13
prowler
View File

@@ -194,8 +194,19 @@ while getopts ":hlLkqp:r:c:g:f:m:M:E:enbVsSxI:A:R:T:w:" OPTION; do
esac
done
clean_up() {
rm -f /tmp/prowler*.policy.*
}
handle_ctrl_c() {
clean_up
exit $EXITCODE
}
# Clean up any temp files when prowler quits unexpectedly
trap "{ rm -f /tmp/prowler*.policy.*; }" EXIT
trap clean_up EXIT
# Clean up and exit if Ctrl-C occurs. Required to allow Ctrl-C to stop Prowler when running in Docker
trap handle_ctrl_c INT
. $PROWLER_DIR/include/colors
. $PROWLER_DIR/include/os_detector