Hi,

I am encountering a problem with this piece of code
that I have written.

**************************************************

    my($child_fh, $parent_fh) = (new IO::Handle, new
IO::Handle);

    socketpair($child_fh, $parent_fh, AF_UNIX,
SOCK_STREAM, PF_UNSPEC)
    or die "socketpair failed: $!";

    $child_fh->autoflush;
    $parent_fh->autoflush;

    if (my $pid = fork) {
        close $parent_fh;
        $fh_sel->add( $child_fh ); # Start out writing to all
children

    } else { # Child starts here
        die "cannot fork: $!" unless defined $pid;

        close $child_fh;
        close STDOUT;
        close STDIN;    

        open(STDOUT, ">&$parent_fh") or die "Cant redirect
STDOUT $!\n";
        open(STDIN, "<&$parent_fh") or die "Cant
redirect STDIN $!\n";
        
        STDOUT->autoflush;
        
        close $parent_fh;
        
        my $cmd = "./executable";
        my $rv = exec "$cmd";

        if (!defined $rv) {
            ts_print("## ERROR: exec(): $!\n");
            exit -1;
        }
    }

**************************************************

In the child process, the STDOUT does not get
redirected.

open(STDOUT, ">&$parent_fh") gives an error saying
invalid argument and therefore I get no reply in the
parent process.

I will appreciate any help that I can get on this.

Thank You,
-VM

__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to