RE: return code?

2018-08-09 Thread Mark Devine
Sent: Saturday, July 28, 2018 16:38 To: ToddAndMargo Cc: perl6-users Subject: RE: return code? Todd, I see that you’re frequently running commands in your code like me. I was looking for a reliable reusable approach for commands for a long time. I’m still learning & not quite ready to

Re: return code?

2018-07-29 Thread ToddAndMargo
On 07/29/2018 03:03 AM, Patrick Spek via perl6-users wrote: You can use the head[2] sub to write it as for @ReturnAry.head(*.elems - 3) -> $line Also, on the $ReturnStr += $Line If you're trying to concatenate a string, you should use the ~ instead of the +, so it'd become

Re: return code?

2018-07-29 Thread ToddAndMargo
*From:* Brandon Allbery *Sent:* Saturday, July 28, 2018 16:22 *To:* ToddAndMargo *Cc:* perl6-users *Subject:* Re: return code? Yes, that's what I was addressing: you can tell run() to do that, keeping stderr separate with :err(). qxx does that internally. On Sat, Jul 28, 2018 at 4:12 PM

Re: return code?

2018-07-29 Thread Patrick Spek via perl6-users
off > to someone more capable of maintaining it. > > If you give it a try, I think that you might find it helpful. > > Thanks, > > Mark > > From: Brandon Allbery > Sent: Saturday, July 28, 2018 16:22 > To: ToddAndMargo > Cc: perl6-users > Subject: Re: retu

Re: return code?

2018-07-29 Thread Patrick Spek via perl6-users
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 I get the idea that you're trying to get a list of lines with the @ReturnAry = split "\n", qqx ( curl $TimeOutStr -L $Url -o $FileName; echo \$\? ); You can use the lines[1] sub for exactly this. Similarly for this line for

Re: return code?

2018-07-29 Thread ToddAndMargo
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

Re: return code?

2018-07-29 Thread ToddAndMargo
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

RE: return code?

2018-07-28 Thread Mark Devine
find it helpful. Thanks, Mark From: Brandon Allbery Sent: Saturday, July 28, 2018 16:22 To: ToddAndMargo Cc: perl6-users Subject: Re: return code? Yes, that's what I was addressing: you can tell run() to do that, keeping stderr separate with :err(). qxx does that internally. On Sat, Jul 28,

Re: return code?

2018-07-28 Thread Brandon Allbery
Yes, that's what I was addressing: you can tell run() to do that, keeping stderr separate with :err(). qxx does that internally. On Sat, Jul 28, 2018 at 4:12 PM ToddAndMargo wrote: > On 07/28/2018 12:56 PM, Brandon Allbery wrote: > > You can control where run() sends things. > > Hi Brandon, > >

Re: return code?

2018-07-28 Thread ToddAndMargo
On 07/28/2018 12:56 PM, Brandon Allbery wrote: You can control where run() sends things. Hi Brandon, I adore the run command. In this particular instance (curl's progress meter, which is written to STDERR), I want STDERR to write to the shell, but want to collect STDIN and the return code.

Re: return code?

2018-07-28 Thread Brandon Allbery
You can control where run() sends things. See the :out and :err named parameters. I think :err($*ERR) is what you want here, although you might also want :err($*OUT) which effectively redirects its stderr to rakudo's stdout. (That said, I don't know if it processes those in the right order; it

Re: return code?

2018-07-28 Thread ToddAndMargo
On Sat, Jul 28, 2018 at 4: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 06:14 AM, Paul

Re: return code?

2018-07-28 Thread ToddAndMargo
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

Re: return code?

2018-07-28 Thread Paul Procacci
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