]> git.proxmox.com Git - pve-common.git/commitdiff
download file from url: simplify error handling
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 4 Aug 2023 10:50:40 +0000 (12:50 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 4 Aug 2023 10:50:40 +0000 (12:50 +0200)
the top-level error handling ensures the temporary downloaded file gets
removed in case of an error, so there is no need to also handle that when
decompression fails..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
src/PVE/Tools.pm

index 41e2724c6895f6a85148683b6297f6469297057a..8c1ad62f37a7eed7a1d13cb38f7d97871ebbb6e9 100644 (file)
@@ -2061,10 +2061,8 @@ sub download_file_from_url {
                die "cant open temporary file $tmp_decomp for decompresson: $!\n";
            }
            print "decompressing $tmp_download to $tmp_decomp\n";
-           eval { run_command($cmd, output => '>&'.fileno($fh)); };
-           my $err = $@;
+           run_command($cmd, output => '>&'.fileno($fh));
            unlink $tmp_download;
-           die "$err\n" if $err;
            rename($tmp_decomp, $dest) or die "unable to rename temporary file: $!\n";
        } else {
            rename($tmp_download, $dest) or die "unable to rename temporary file: $!\n";