RE: return code?

2018-07-28 Thread Mark Devine
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 step up to contribute to the ecosystem yet (https://docs.perl6.org/language/modules.html). After

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: > vs gt

2018-07-28 Thread Brandon Allbery
If you really want a headache, go look at the revision history for vercmp() in the RPM repo. On Sat, Jul 28, 2018 at 4:08 PM ToddAndMargo wrote: > On 07/28/2018 08:26 AM, Brandon Allbery wrote: > > I think you can use Version.new on that and compare them reasonably > > directly? That said,

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: > vs gt

2018-07-28 Thread ToddAndMargo
On 07/28/2018 08:26 AM, Brandon Allbery wrote: I think you can use Version.new on that and compare them reasonably directly? That said, comparison of version numbers is a bit of a minefield for exactly this reason: not everyone agrees on when to use string vs.  numeric comparison, or what to

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: > vs gt

2018-07-28 Thread Brandon Allbery
I think you can use Version.new on that and compare them reasonably directly? That said, comparison of version numbers is a bit of a minefield for exactly this reason: not everyone agrees on when to use string vs. numeric comparison, or what to do when one is numeric and the other isn't. On Sat,

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

return code?

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

Re: > vs gt

2018-07-28 Thread ToddAndMargo
On 07/27/2018 11:27 PM, ToddAndMargo wrote: On Sat, Jul 28, 2018 at 1:54 AM ToddAndMargo > wrote:     Hi All,     Why does this work: if $CurlStr.chars > 200 {     But this does not? if $CurlStr.chars gt 200 {     79 was not larger than 200

Re: > vs gt

2018-07-28 Thread ToddAndMargo
On Sat, Jul 28, 2018 at 1:54 AM ToddAndMargo > wrote: Hi All, Why does this work: if $CurlStr.chars > 200 { But this does not? if $CurlStr.chars gt 200 { 79 was not larger than 200 Many thanks, -T On