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

On 07/28/2018 01:50 AM, Benji wrote:
I don't think you can with `qqx`. It returns the string output directly.

You can with `run` though.

my $p = run 'ls';
say $p.exitcode;

Hi,

I am writing exitcode down in my run notes!  Thank you.

I had been using
    $RtnCode = $proc.status;

What I am trying to do is run curl and read STDIN and the
return code, but leave the STDERR progress bar on the
shell.  I can't use "run" for this as I want the program
I called to write STDERR to the shell.

so far I have
$ p6 'my $x="cat /etc/hosts; echo \$\?"; my $y = qqx ( $x ); say "$y";'

which sends the exit code to the last line, which is pretty easy to separate from the STDIN.

-T

Reply via email to