hello people,

<promotion shameless>
    French Perl Workshop is coming and would be a better
    event if *you* take part of it
    https://journeesperl.fr/jp2019/talks
</promotion>

now the problem ...

let's say i have a raku script to wrap mutt.
in this script, i have

* $body is the content of the body my message
* $subject and $recipient are self explainatory

from the shell, i call mutt those ways

    mutt -s $subject $recipient <<< $body
    mutt -s $subject $recipient <<.
    $body
    .

i'm searching for the shortest/simplest way to
do that in raku (meaning stay away from react/whenever for very basic
usages) .

so it seemed to me that `run` is a good candidate
and expect filehandlers or filenames to setup the std.

i tried some variations around

    my $p = run 'cat', '-n', in => $*OUT, :out;
    $*OUT.say for < i bet on you, raku >;
    $*ERR.say: $p.out.slurp;

    my $p = run 'cat', '-n', in => "/dev/stdout", :out;
    $*OUT.say for < i bet on you, raku >;
    $*ERR.say: $p.out.slurp;

    my $o2 = $*OUT.clone;
    my $p = run 'cat', '-n', in => $o2, :out;
    $o2.say for < i bet on you, raku >;
    $*ERR.say: $p.out.slurp;

    ...

none of those made raku unhappy but none of them does the job.
i'm on my way to use Proc::Async.new ... but before that, i would like
to ask if there is a simpler solution.

regards,
marc

Reply via email to