diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-05-17 14:15:17 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-05-17 14:15:17 +0200 |
commit | 175c7325595b99c046b479a203e0f4175afae18e (patch) | |
tree | d3525a57b14921fcbde5a103c33beffec1a909c1 | |
parent | 544c84c3d41005f1848a904477104802ffc5d635 (diff) | |
download | abrt-175c7325595b99c046b479a203e0f4175afae18e.tar.gz abrt-175c7325595b99c046b479a203e0f4175afae18e.tar.xz abrt-175c7325595b99c046b479a203e0f4175afae18e.zip |
kill yumdownloader if abrt-debuginfo-install is terminated mid-flight
This is needed to eventually fix
https://bugzilla.redhat.com/show_bug.cgi?id=569694
yumdownloader not killed by ABRT
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rwxr-xr-x | src/Daemon/abrt-debuginfo-install | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Daemon/abrt-debuginfo-install b/src/Daemon/abrt-debuginfo-install index 12b9153a..9b9d63f1 100755 --- a/src/Daemon/abrt-debuginfo-install +++ b/src/Daemon/abrt-debuginfo-install @@ -249,8 +249,12 @@ download_packages() { cmd="yumdownloader $yum_repo_opts --quiet $pkg" $debug && echo "Running: $cmd" >&2 # eval is needed to strip away ''s in $yum_repo_opts - eval $cmd >>yumdownloader.OUT 2>&1 + eval $cmd >>yumdownloader.OUT 2>&1 & + # using EXIT handler and this, make sure we kill yumdownloader if we exit: + CHILD_PID=$! + wait err=$? + CHILD_PID="" echo "exitcode:$err" >>yumdownloader.OUT echo >>yumdownloader.OUT test $err = 0 || echo "Download of $pkg failed!" @@ -319,6 +323,11 @@ cd "$tempdir" || exit 2 abort_if_low_on_disk_space 1024 +# A hook to stop yumdownloader, in case we are terminated by kill -TERM etc. +CHILD_PID="" +trap 'test x"$CHILD_PID" != x"" && kill -- "$CHILD_PID"' EXIT + + $debug && echo "Downloading rpms to $tempdir" |