On Sat, Jul 28, 2018 at 4:37 AM, ToddAndMargo <toddandma...@zoho.com <mailto:toddandma...@zoho.com>> 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 06:14 AM, Paul Procacci wrote:
I'm not sure about qqx because I too am a fledgling perl6 programmer, but the run routine returns a Proc object that has an exitcode method.

++++++++++++++++++++++++
my $proc = run 'ls', 'dir!';
$proc.exitcode.say;
++++++++++++++++++++++++

Right in the documentation the following is stated as well:

"See alsorun <https://docs.perl6.org/routine/run>andProc::Async <https://docs.perl6.org/type/Proc::Async>for better ways to execute external commands. "


Hi Paul,

I adore the run command and use it very frequently.

I this instance, I actually want to write STDERR to the
shell and only capture STDIN and the exit code.
I am trying to get "curl" to show its progress meter,
which writes to STDERR.

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

which sends STDIN and the exit code to $y, which I can deal with.

Thank you for the help!

-T

Reply via email to