aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2021-05-10 08:40:14 +0000
committermerakor <cem@ckyln.com>2021-05-10 08:40:14 +0000
commit7aba2edbe0e3eaa8afd260c8f944219aa02de0de (patch)
tree5789d32bb707e382e2e51075c137597fec5275b2 /src
parenta5295b5a8e87c436a8bf1a348a61378efe42ffdf (diff)
parent7ed59d795b9aba99e3c6c4ed3624a192c53aa7d2 (diff)
downloadcpt-7aba2edbe0e3eaa8afd260c8f944219aa02de0de.tar.gz
merge maintenance branch
FossilOrigin-Name: de92ec227b6f016847334689456895177b2d727f031464e1feb67d59b9df53c9
Diffstat (limited to 'src')
-rw-r--r--src/cpt-lib.in14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/cpt-lib.in b/src/cpt-lib.in
index 13f5847..714e4a0 100644
--- a/src/cpt-lib.in
+++ b/src/cpt-lib.in
@@ -43,8 +43,11 @@ trap_set() {
trap pkg_clean EXIT
trap 'pkg_clean; exit 1' INT
;;
- block) trap '' INT ;;
- unset) trap - EXIT INT ;;
+ handle-int)
+ trap pkg_clean INT
+ ;;
+ block) trap '' INT ;;
+ unset) trap - EXIT INT ;;
esac
}
@@ -703,11 +706,18 @@ pkg_sources() {
elif [ -z "${src##*://*}" ]; then
log "$1" "Downloading $src"
+ # We don't want our trap to exit immediately here if we receive an
+ # interrupt, we handle this ourselves.
+ trap_set handle-int
+
curl "$src" -fLo "${src##*/}" || {
rm -f "${src##*/}"
die "$1" "Failed to download $src"
}
+ # Restore original trap value.
+ trap_set cleanup
+
# Local source.
elif [ -f "$repo_dir/$src" ]; then
log "$1" "Found local file '$src'"