diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2018-09-07 19:05:40 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2018-09-07 19:05:40 +0200 |
commit | 4510395a410d74e6f2b63776319ac35ccc414cd9 (patch) | |
tree | 502176e079400bea538cd2616817b7e8fd493256 /sfeed_update | |
parent | 1b5891b03d4578526823ea1c8f93c87cdfa6e85b (diff) |
sfeed_update: don't always exit 1, exit 130 on SIGINT, exit 0 otherwise
Reported by "Dekedro", thanks!
Diffstat (limited to 'sfeed_update')
-rwxr-xr-x | sfeed_update | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/sfeed_update b/sfeed_update index c81ec6b..7578a1d 100755 --- a/sfeed_update +++ b/sfeed_update @@ -97,8 +97,8 @@ feed() { fi) & } -terminated() { - isrunning="0" +interrupted() { + isinterrupted="1" } cleanup() { @@ -115,10 +115,10 @@ feeds() { loadconfig "$1" # fetch feeds and store in temporary file. sfeedtmpdir="$(mktemp -d '/tmp/sfeed_XXXXXX')" -# kill whole current process group on ^C. -isrunning="1" +# kill whole current process group on ^C (SIGINT). +isinterrupted="0" # SIGTERM: signal to terminate parent. -trap -- "terminated" "15" +trap -- "interrupted" "15" # SIGINT: kill all running childs >:D trap -- "kill -TERM -$$" "2" # make sure path exists. @@ -129,5 +129,6 @@ feeds wait # cleanup temporary files etc. cleanup -# if terminated. -[ "${isrunning}" = "0" ] && exit 1 +# on SIGINT exit with 128 + signal (SIGINT = 2). +[ "${isinterrupted}" = "1" ] && exit 130 +exit 0 |