>From inside a program I'd like to send some input to the stdin of external
program and read back the stdout.

The example in https://docs.perl6.org/language/ipc under proc comes close
to what I want:

my $echo = run 'echo', 'Hello, world', :out;
my $cat  = run 'cat', '-n', :in($echo.out), :out;
say $cat.out.get;
$cat.out.close();

That works, however what I want however is a single external process, sort
of like:

my $input = q:to/EOS/;
line of text
another line
EOS

my $cat  = run 'cat', '-n', :in($input.print), :out;
my $output = $cat.out.get;
$cat.in.close;
$cat.out.close;

say "done";
say $output;

But that is not correct. I seem to be missing something.

Reply via email to