mirror of
https://github.com/smxi/inxi.git
synced 2024-11-16 16:21:39 +00:00
some downloader bugs
This commit is contained in:
parent
2e1a4df1e1
commit
a1129aa7ca
27
inxi
27
inxi
|
@ -1939,10 +1939,14 @@ sub download_file {
|
||||||
# print "$dl{'no-ssl-opt'}\n";
|
# print "$dl{'no-ssl-opt'}\n";
|
||||||
# print "$dl{'dl'}\n";
|
# print "$dl{'dl'}\n";
|
||||||
# tiny supports spider sort of
|
# tiny supports spider sort of
|
||||||
|
## NOTE: 1 is success, 0 false for Perl
|
||||||
if ($dl{'dl'} eq 'tiny' ){
|
if ($dl{'dl'} eq 'tiny' ){
|
||||||
$cmd = "Using tiny: type: $type \nurl: $url \nfile: $file";
|
$cmd = "Using tiny: type: $type \nurl: $url \nfile: $file";
|
||||||
$result = get_file($type, $url, $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 {
|
else {
|
||||||
if ($type eq 'stdout'){
|
if ($type eq 'stdout'){
|
||||||
$args = $dl{'stdout'};
|
$args = $dl{'stdout'};
|
||||||
|
@ -1954,7 +1958,7 @@ sub download_file {
|
||||||
$args = $dl{'file'};
|
$args = $dl{'file'};
|
||||||
$cmd = "$dl{'dl'} $dl{'no-ssl-opt'} $timeout $args $file $url $dl{'null'}";
|
$cmd = "$dl{'dl'} $dl{'no-ssl-opt'} $timeout $args $file $url $dl{'null'}";
|
||||||
system($cmd);
|
system($cmd);
|
||||||
$result = $?;
|
$result = ($?) ? 0 : 1; # reverse these into Perl t/f
|
||||||
$debug_data = $result;
|
$debug_data = $result;
|
||||||
}
|
}
|
||||||
elsif ( $dl{'dl'} eq 'wget' && $type eq 'spider'){
|
elsif ( $dl{'dl'} eq 'wget' && $type eq 'spider'){
|
||||||
|
@ -3205,19 +3209,20 @@ sub update_man {
|
||||||
system( 'mandb' );
|
system( 'mandb' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# if ( $dl{'dl'} =~ /tiny|wget/){
|
if ( $dl{'dl'} =~ /tiny|wget/){
|
||||||
# print "Checking Man page download URL...\n";
|
print "Checking Man page download URL...\n";
|
||||||
# download_file('spider', $man_file_url);
|
download_file('spider', $man_file_url);
|
||||||
# $downloader_man_error = $?;
|
$downloader_man_error = $?;
|
||||||
# }
|
}
|
||||||
if ( $downloader_man_error == 1 ){
|
if ( $downloader_man_error ){
|
||||||
# if ( $dl{'dl'} =~ /tiny|wget/){
|
if ( $dl{'dl'} =~ /tiny|wget/){
|
||||||
# print "Man file download URL verified: $man_file_url\n";
|
print "Man file download URL verified: $man_file_url\n";
|
||||||
# }
|
}
|
||||||
print "Downloading Man page file now.\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 );
|
download_file('file', $man_file_url, $man_file_path );
|
||||||
$downloader_man_error = $?;
|
$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 "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";
|
print "Check the error messages for what happened. Error: $downloader_man_error\n";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue