]> git.proxmox.com Git - pve-common.git/commitdiff
tools: download_file_from_url: handle interrupts
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 15 Jun 2021 12:20:49 +0000 (14:20 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 15 Jun 2021 12:20:49 +0000 (14:20 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/Tools.pm

index a5efd60418b0eca4cf23c6d30ad7133794ebdbea..567f604347880e7dd5421c8a93a95ca1623bc9f7 100644 (file)
@@ -1865,6 +1865,11 @@ sub download_file_from_url {
            }
        }
 
+       local $SIG{INT} = sub {
+           unlink $tmpdest or warn "could not cleanup temporary file: $!";
+           die "got interrupted by signal\n";
+       };
+
        { # limit the scope of the ENV change
            local %ENV;
            if ($opts->{http_proxy}) {