Commit 944cfa30 authored by tous's avatar tous

Set a signal handler to cleanup the temp files

parent f4625e9b
......@@ -126,7 +126,7 @@ method run () {
$ua->protocols_allowed([qw(http https)]);
my $req = HTTP::Request->new('GET', $self->uri);
my ($temp_fh, $temp_filename) = tempfile;
our ($temp_fh, $temp_filename) = tempfile;
close $temp_fh;
sub clean_fatal {
......@@ -136,6 +136,11 @@ method run () {
$self->fatal(@_);
}
$SIG{TERM} = sub {
unlink $temp_filename if defined $temp_filename;
exit;
};
$ua->max_size($self->size);
my $res = $ua->request($req, $temp_filename);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment