in reply to Re^3: IPC::Open3 not connecting network socket handle
in thread IPC::Open3 not connecting network socket handle
Here is the result:#!/usr/bin/perl use warnings; use strict; use IO::Socket; use IPC::Open3; my $sock = new IO::Socket::INET ( LocalHost => '127.0.0.1', LocalPort => '1818', Proto => 'tcp', Listen => 1, ReuseAddr => 1, Timeout => 20 ); die "Could not create socket: $!\n" unless $sock; our $new_sock = $sock->accept() or die "No one came!"; my $pid = open3( "<&" . fileno($new_sock), ">&STDOUT", ">&STDERR", "/b +in/cat" ); waitpid( $pid, 0 );
sh-3.2# ./test.pl open3: close(5) failed: Bad file number at ./test.pl line 21 sh-3.2# ps -ef | grep /bin/cat root 6124 6106 1 12:57:29 pts/3 0:00 grep /bin/cat root 6122 1 1 12:57:21 pts/3 0:00 /bin/cat sh-3.2# Blah blah this is text coming from my telnet session
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: IPC::Open3 not connecting network socket handle
by ikegami (Patriarch) on Jul 24, 2009 at 17:16 UTC |