https://docs.raku.org/type/Proc

my $p = run "cat", "cat - > outfile", :in, :out;
$p.in.say: "Hello,\nworld!";


On Wed, Nov 11, 2020 at 7:15 PM Sean McAfee <eef...@gmail.com> wrote:

> I posted this question on Stack Overflow a few days ago:
> https://stackoverflow.com/questions/64757138/raku-sending-a-string-to-a-subprocesss-standard-input
>
> ...but there haven't been any answers, so I'm asking here.
>
> The tl;dr is that I don't see an obvious way to send data to a
> subprocess's standard input stream, other than by creating a second
> subprocess.
>
> For a simple example, suppose I wanted to store a file on a remote host
> with ssh:
>
>     my $content = 'file contents';
>     run 'ssh', 'myhost', 'cat > outfile', :in($what-goes-here);
>
> The only solution I've found after a lot of searching is not very
> appealing.
>
>     my $echo = run 'echo', $content, :out;
>     run 'ssh', 'myhost', 'cat > outfile', :in($echo.out);
>
> Is there any better way?
>
>

-- 
__________________

:(){ :|:& };:

Reply via email to