Todd,

I cleaned up my code and published it (with the help of Patrick Spek -- thanks 
again).

CPAN:   https://modules.perl6.org/dist/Async::Command:cpan:MLDEVINE

I’ve been using it in an enterprise environment with 1000+ UNIX/Linux servers.  
I’m able to launch hundreds of SSH commands at once and sort out each 
Proc::Async’s $*OUT and $*ERR without line noise.  For version 0.0.2 I 
hardcoded a throttle of 16 threads after graphing performance on a 4 x Linux VM 
– seems safe yet efficient.

Criticisms & suggestions always welcome by Perl6 mentors.

Thanks,

Mark


From: Mark Devine <m...@markdevine.com>
Sent: Saturday, July 28, 2018 16:38
To: ToddAndMargo <toddandma...@zoho.com>
Cc: perl6-users <perl6-users@perl.org>
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 step up to contribute to the ecosystem yet 
(https://docs.perl6.org/language/modules.html).  After reading Perl 6 
Fundamentals (Moritz Lenz), I cobbled together a reusable Command.pm6 for 
myself based on his examples.  Method ‘run’ for a single async command, or 
methods ‘sow’+‘reap’ for multiple async (possibly all different) commands, with 
all returns collected in Command::Result objects.

https://github.com/markldevine/perl6-Command

Now whenever I need any general-purpose external command, I ‘use Command;’ and 
it has never failed me (I.e. curl, , ssh, etc.).

Because it’s not in the ecosystem, git clone it into a directory and set 
PERL6LIB=<dir > or ‘use lib <dir>’ internally.  Docs are internal POD.

If any of the Perl 6 big brains are reading this and would provide some welcome 
criticism resulting in something that should be published, I would upload as 
per the instructions it or hand it 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 <allber...@gmail.com<mailto:allber...@gmail.com>>
Sent: Saturday, July 28, 2018 16:22
To: ToddAndMargo <toddandma...@zoho.com<mailto:toddandma...@zoho.com>>
Cc: perl6-users <perl6-users@perl.org<mailto:perl6-users@perl.org>>
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 ToddAndMargo 
<toddandma...@zoho.com<mailto:toddandma...@zoho.com>> wrote:
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.

    curl xxxx; echo $?

will send both to STDIN, which I can easily deal with.

-T


--
brandon s allbery kf8nh                               sine nomine associates
allber...@gmail.com<mailto:allber...@gmail.com>                                 
 ballb...@sinenomine.net<mailto:ballb...@sinenomine.net>
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net

Reply via email to