title: Raku: Sending a string to a subprocess's standard input
body: <p>I'd like to send a string to a subprocess's standard input stream, as I might do in Perl 5 like this:</p>
  <pre><code>pipe *READ, *WRITE;
  
  if (my $pid = fork()) {
      close READ;
      print WRITE &quot;Hello world!\n&quot;;
      close WRITE;
  } else {
      close WRITE;
      open STDIN, '&lt;&amp;=' . fileno READ;
      close READ;
      exec 'cat';
  }
  </code></pre>
  <p>What's the equivalent construction in Raku?</p>
  <p>I can send any input to a an external <code>cat</code> process to get it back in a stream I can pass to yet another process, but that's just terrible.</p>
  <p>I've found <a href="https://github.com/hoelzro/p6-io-string/" rel="noreferrer">this</a> Raku module that seems relevant, but it has &quot;Input as well as output&quot; as a TODO, so it doesn't help me now.</p>
  <p>There's also <a href="https://stackoverflow.com/questions/47271120/how-to-pipe-a-string-to-process-stdin">this question</a> on this very site that matches this one closely.  That author asked for a solution that doesn't rely on an external process, as I am, but the accepted solution still uses an external process.</p>
  <p>Finally, I note the <a href="https://docs.raku.org/type/IO::Pipe" rel="noreferrer">docs</a> for Raku's <code>IO::Pipe</code> class, which seems like it should fit the bill.  However, that page says:</p>
  <pre><code>Pipes can be easily constructed with sub run and Proc::Async.new.
  </code></pre>
  <p>...which I explicitly want to avoid.  I tried just creating a new <code>IO::Pipe</code> object, hoping I could use its <code>in</code> and <code>out</code> streams in a natural way, but I get:</p>
  <pre><code>&gt; my $pipe = IO::Pipe.new
  Required named parameter 'on-close' not passed
    in block &lt;unit&gt; at &lt;unknown file&gt; line 1
  </code></pre>
  <p>That parameter is not mentioned on the doc page, so I suppose I've ventured into undefined territory here.</p>