diff --git a/inxi b/inxi index 1d76056..2d264b8 100755 --- a/inxi +++ b/inxi @@ -1939,10 +1939,14 @@ sub download_file { # print "$dl{'no-ssl-opt'}\n"; # print "$dl{'dl'}\n"; # tiny supports spider sort of + ## NOTE: 1 is success, 0 false for Perl if ($dl{'dl'} eq 'tiny' ){ $cmd = "Using tiny: type: $type \nurl: $url \nfile: $file"; $result = get_file($type, $url, $file); + $debug_data = $result; } + # But: 0 is success, and 1 is false for these + # when strings are returned, they will be taken as true else { if ($type eq 'stdout'){ $args = $dl{'stdout'}; @@ -1954,7 +1958,7 @@ sub download_file { $args = $dl{'file'}; $cmd = "$dl{'dl'} $dl{'no-ssl-opt'} $timeout $args $file $url $dl{'null'}"; system($cmd); - $result = $?; + $result = ($?) ? 0 : 1; # reverse these into Perl t/f $debug_data = $result; } elsif ( $dl{'dl'} eq 'wget' && $type eq 'spider'){ @@ -3205,19 +3209,20 @@ sub update_man { system( 'mandb' ); } } -# if ( $dl{'dl'} =~ /tiny|wget/){ -# print "Checking Man page download URL...\n"; -# download_file('spider', $man_file_url); -# $downloader_man_error = $?; -# } - if ( $downloader_man_error == 1 ){ -# if ( $dl{'dl'} =~ /tiny|wget/){ -# print "Man file download URL verified: $man_file_url\n"; -# } + if ( $dl{'dl'} =~ /tiny|wget/){ + print "Checking Man page download URL...\n"; + download_file('spider', $man_file_url); + $downloader_man_error = $?; + } + if ( $downloader_man_error ){ + if ( $dl{'dl'} =~ /tiny|wget/){ + print "Man file download URL verified: $man_file_url\n"; + } print "Downloading Man page file now.\n"; + # returns perl, 1 for true, 0 for false, even when using shell tool returns download_file('file', $man_file_url, $man_file_path ); $downloader_man_error = $?; - if ( $downloader_man_error == 0 ){ + if ( !$downloader_man_error ){ print "Oh no! Something went wrong downloading the Man file at: $man_file_url\n"; print "Check the error messages for what happened. Error: $downloader_man_error\n"; }