in reply to Open3 in child process not capturing errors correctly. .
I would try the rsh command from the shell, redirecting errors using the standard 2>&1 syntax.#! /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;
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...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE (tilly) 1: Open3 in child process not capturing errors correctly. .
by geektron (Curate) on Oct 26, 2000 at 10:07 UTC |