diff options
| author | B. Watson <urchlay@slackware.uk> | 2026-10-26 16:32:48 -0400 |
|---|---|---|
| committer | B. Watson <urchlay@slackware.uk> | 2026-10-26 16:32:48 -0400 |
| commit | c22b4c99ba4e66dcbf97ce0fb4b6c38372e20be6 (patch) | |
| tree | 0fee7027a519654cc3e4cf29d68c898147bbc2dc | |
| parent | c1c13c7b03bde55610cd75e0aafe99a6d41f7bee (diff) | |
| download | greypool-c22b4c99ba4e66dcbf97ce0fb4b6c38372e20be6.tar.gz | |
Handle ^C gracefully during wget downloads.
| -rw-r--r-- | TODO | 4 | ||||
| -rwxr-xr-x | greypool | 9 |
2 files changed, 9 insertions, 4 deletions
@@ -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? @@ -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. |
