develooper Front page | perl.perl6.users | Postings from August 2018

RE: return code?

Thread Previous | Thread Next
Mark Devine
August 10, 2018 02:18
RE: return code?
Message ID:

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


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.



From: Mark Devine <>
Sent: Saturday, July 28, 2018 16:38
To: ToddAndMargo <>
Cc: perl6-users <>
Subject: RE: return code?


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 (  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.

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.



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 ToddAndMargo <<>> 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.


brandon s allbery kf8nh                               sine nomine associates<>                        <>
unix, openafs, kerberos, infrastructure, xmonad

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About