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 could be like the difference between >foo 2>&1 and 2>&1 >foo in shell. There have been a number of odd confusions in the history of that code.)
On Sat, Jul 28, 2018 at 3:52 PM ToddAndMargo <toddandma...@zoho.com> wrote: > >> 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 > -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net