I would guess that rsh is doing something strange. I don't have it here but the code example looks like it should work. Certainly the following snippet works perfectly:
#! /usr/bin/perl use IPC::Open3; use IO::Handle; my $writer = IO::Handle->new(); my $reader = IO::Handle->new(); eval { my $cpid = open3( $writer, $reader, $reader, "perl" ); }; die if $@; print $writer <<'PROG'; print STDOUT "Hello to STDOUT\n"; print STDERR "Hello to STDERR\n"; PROG close($writer); print <$reader> if @ARGV;
I would try the rsh command from the shell, redirecting errors using the standard 2>&1 syntax.

But an important non-stylistic note. After your eval, check $@ and if it is true then make darned sure that you register an error. Also make sure that the error message has all of the information listed in perlstyle. In this case that would include your description of what was going on, the exact rpc command, and the full text of the error. Look for the "open3" pattern to figure out whether you will die or print a message. But make that message actually useful for debugging!!!

Based on past painful experience I will refuse to work with code that doesn't take this basic step. Education is key. And a job where I found myself dealing with this kind of code without being allowed to do something about it (eg rewrite) would be a job I would shortly leave...


In reply to RE (tilly) 1: Open3 in child process not capturing errors correctly. . by tilly
in thread Open3 in child process not capturing errors correctly. . by geektron

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.