title: readline hangs on manual pipe()
body: <p>I'm trying to dispel the magic fork variant of open:</p>
  
  <pre><code># magic-fork.pl
  if (open my $fh, '-|') { # fork self, make new fd for reading, attach child STDOUT to it
      STDOUT-&gt;say('parent getpid: ', $$);
      STDOUT-&gt;say('parent STDOUT-&gt;fileno: ', STDOUT-&gt;fileno);
      STDOUT-&gt;say('parent $fh-&gt;fileno: ', $fh-&gt;fileno);
      while (my $line = $fh-&gt;getline) {
          STDOUT-&gt;print('parent readline from child: ', $line);
      }
  } else {
      STDOUT-&gt;say('child getpid: ', $$);
      STDOUT-&gt;say('child STDOUT-&gt;fileno: ', STDOUT-&gt;fileno);
  }
  </code></pre>
  
  <p>It runs and finishes.</p>
  
  <pre><code># plain-fork.pl
  pipe my $r, my $w;
  if (fork) {
      STDOUT-&gt;say('parent getpid: ', $$);
      STDOUT-&gt;say('parent STDOUT-&gt;fileno: ', STDOUT-&gt;fileno);
      STDOUT-&gt;say('parent $r-&gt;fileno: ', $r-&gt;fileno);
      STDOUT-&gt;say('parent $w-&gt;fileno: ', $w-&gt;fileno);
      while (my $line = $r-&gt;getline) {
          STDOUT-&gt;print('parent readline from child: ', $line);
      }
  } else {
      $w-&gt;say('child getpid: ', $$);
      $w-&gt;say('child $r-&gt;fileno: ', $r-&gt;fileno);
      $w-&gt;say('child $w-&gt;fileno: ', $w-&gt;fileno);
      $w-&gt;say('child STDOUT-&gt;fileno: ', STDOUT-&gt;fileno);
  }
  </code></pre>
  
  <p>This program unexpectedly hangs in the loop.</p>
  
  <p>I tried to no avail:</p>
  
  <ul>
  <li>calling $w->autoflush(1)</li>
  <li>explicit close on handles</li>
  <li>explicit exit</li>
  <li>POSIX::dup2 $w onto STDOUT</li>
  <li>checking strace -ff to see whether I missed a crucial syscall</li>
  </ul>
  
  <p>What's the problem?</p>