Subject: | SIGINT interruption leaves partially downloaded files |
If you hit Ctrl-C to interrupt a `perlbrew install`, perhaps because you realise you forgot a commandline option, if perlbrew has started to download the distribution tarball but it hasn't completed yet, it will leave behind that partial file.
$ perlbrew install perl-5.23.8
Fetching perl 5.23.8 as /home/leo/perl5/perlbrew/dists/perl-5.23.8.tar.bz2
Download http://www.cpan.org/src/5.0/perl-5.23.8.tar.bz2 to /home/leo/perl5/perlbrew/dists/perl-5.23.8.tar.bz2
^CERROR: Failed to download http://www.cpan.org/src/5.0/perl-5.23.8.tar.bz2
$ ll perl5/perlbrew/dists/
total 316M
...
-rw-r--r-- 1 leo leo 296K Mar 16 14:46 perl-5.23.8.tar.bz2
Trying to resume this with different options then complains:
$ perlbrew install perl-5.23.8
bzip2: Compressed file ends unexpectedly;
perhaps it is corrupted? *Possible* reason follows.
...
It would be nice to put a
local $SIG{INT} = local $SIG{TERM} = sub {
unlink (the download file);
};
in the code here to avoid this upset.
--
Paul Evans