On 07/28/2018 11:46 PM, ToddAndMargo wrote:
On 07/28/2018 01:37 AM, ToddAndMargo wrote:
Hi All,
How do I get the bash return code ("$?") from
the following?
$ReturnStr = qqx ( curl $TimeOutStr -L $Url -o $FileName ).lines;
Many thanks,
-T
Followup:
This is what I came up with:
if $ProgressBar {
# This need a space ofter the qqx
# $ p6 'my $x="cat /etc/hosts; echo \$\?"; my @y = split "\n",
qqx ( $x ); say @y[@y.elems-2];'
# 0
# <blank line>
@ReturnAry = split "\n", qqx ( curl $TimeOutStr -L $Url -o
$FileName; echo \$\? );
for @ReturnAry[ 0 .. @ReturnAry.elems - 3 ] -> $Line {
$ReturnStr += $Line; }
print "\n";
$ReturnCode = @ReturnAry[ @ReturnAry.elems - 2 ];
} else {
( $ReturnStr, $ReturnCode ) = RunNoShell ( "curl $TimeOutStr -L
$Url -o $FileName" );
}
return ( $ReturnStr, $ReturnCode );
This is what it looks like when run:
$ GetUpdates.pl6 GetClassicShell
Mozilla Mirror <releases.mozilla.org>
Checking GetClassicShell
IsCurrentRevNewer::GetClassicShell: debugging statement:
LatestRev <4.3.1> OldRev <0>
GetUpdates.pl6::GetClassicShell: No new revision located
% Total % Received % Xferd Average Speed Time Time Time
Current
Dload Upload Total Spent Left
Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:--
--:--:-- 0
100 7019k 100 7019k 0 0 783k 0 0:00:08 0:00:08 --:--:--
825k
GetClassicShell Debug:
OldRev = 0
OldFileName =
LatestRev = 4.3.1
NewFileName =
/home/CDs/Windows/W10/ClassicShell/ClassicShellSetup-4.3.1.exe
NewFileSize = 7187816
Status = 2 (Update)
GetClassicShell new update downloaded 0
--> 4.3.1