mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-26 20:20:53 +03:00
blockcheck: graceful quit when piping output
This commit is contained in:
parent
f6f4abb04c
commit
006fd8d760
@ -782,11 +782,8 @@ check_dns()
|
||||
}
|
||||
|
||||
|
||||
sigint()
|
||||
unprepare_all()
|
||||
{
|
||||
# make sure we are not in a middle state that impacts connectivity
|
||||
echo
|
||||
echo terminating...
|
||||
[ -n "$IPV" ] && {
|
||||
tpws_ipt_unprepare 80
|
||||
tpws_ipt_unprepare 443
|
||||
@ -794,8 +791,23 @@ sigint()
|
||||
pktws_ipt_unprepare 443
|
||||
}
|
||||
ws_kill
|
||||
}
|
||||
|
||||
sigint()
|
||||
{
|
||||
# make sure we are not in a middle state that impacts connectivity
|
||||
echo
|
||||
echo terminating...
|
||||
unprepare_all
|
||||
exitp 1
|
||||
}
|
||||
sigpipe()
|
||||
{
|
||||
# make sure we are not in a middle state that impacts connectivity
|
||||
# must not write anything here to stdout
|
||||
unprepare_all
|
||||
exit 1
|
||||
}
|
||||
|
||||
check_system
|
||||
check_prerequisites
|
||||
@ -804,10 +816,12 @@ check_dns
|
||||
ask_params
|
||||
|
||||
PID=
|
||||
trap 'sigint' 2
|
||||
trap sigint INT
|
||||
trap sigpipe PIPE
|
||||
[ "$ENABLE_HTTP" = 1 ] && check_domain_http $DOMAIN
|
||||
[ "$ENABLE_HTTPS_TLS12" = 1 ] && check_domain_https_tls12 $DOMAIN
|
||||
[ "$ENABLE_HTTPS_TLS13" = 1 ] && check_domain_https_tls13 $DOMAIN
|
||||
trap - 2
|
||||
trap - PIPE
|
||||
trap - INT
|
||||
|
||||
exitp 0
|
||||
|
Loading…
Reference in New Issue
Block a user