aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2026-10-26 16:32:48 -0400
committerB. Watson <urchlay@slackware.uk>2026-10-26 16:32:48 -0400
commitc22b4c99ba4e66dcbf97ce0fb4b6c38372e20be6 (patch)
tree0fee7027a519654cc3e4cf29d68c898147bbc2dc
parentc1c13c7b03bde55610cd75e0aafe99a6d41f7bee (diff)
downloadgreypool-c22b4c99ba4e66dcbf97ce0fb4b6c38372e20be6.tar.gz
Handle ^C gracefully during wget downloads.
-rw-r--r--TODO4
-rwxr-xr-xgreypool9
2 files changed, 9 insertions, 4 deletions
diff --git a/TODO b/TODO
index 4b7114a..4672246 100644
--- a/TODO
+++ b/TODO
@@ -1,12 +1,8 @@
TODO list for greypool
-- color and pager options for the config file.
-
- handle the case where a project has more than one maintainer...
or no maintainer. this doesn't happen with SlackBuilds.org.
-- handle ^C gracefully during wget downloads.
-
- improve the interactive config:
- cache the repo list?
- possibly use dialog?
diff --git a/greypool b/greypool
index 8cb8281..8be422a 100755
--- a/greypool
+++ b/greypool
@@ -562,6 +562,10 @@ sub stamp_cache {
sub check_cache {
mkdir_p $cachedir;
return if cache_ok() || $no_download;
+ invalidate_cache();
+}
+
+sub invalidate_cache {
for(<$cachedir/*>) {
unlink $_;
}
@@ -603,8 +607,13 @@ sub download {
"'$url'";
debug $cmd;
+
+ $SIG{INT} = sub { invalidate_cache(); fatal "exiting due to ^C"; exit 1; };
my $status = system($cmd);
+ $SIG{INT} = 'DEFAULT';
+
if($status) {
+ invalidate_cache();
fatal "wget failed, exit status " . ($status >> 8);
}
sleep 1; # repology wants to limit requests to 1 per sec.